[#ASN1_item_sign_ex]
= ASN1&lowbar;item&lowbar;sign&lowbar;ex
:mrdocs:

Sign the DER encoding of `data` using `it` and write AlgorithmIdentifier(s) plus the signature&period;

== Synopsis

Declared in `&lt;openssl&sol;asn1&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
ASN1&lowbar;item&lowbar;sign&lowbar;ex(
    xref:ASN1_ITEM.adoc[ASN1&lowbar;ITEM] const* it,
    xref:X509_ALGOR.adoc[X509&lowbar;ALGOR]* algor1,
    xref:X509_ALGOR.adoc[X509&lowbar;ALGOR]* algor2,
    xref:ASN1_BIT_STRING.adoc[ASN1&lowbar;BIT&lowbar;STRING]* signature,
    void const* data,
    xref:ASN1_OCTET_STRING.adoc[ASN1&lowbar;OCTET&lowbar;STRING] const* id,
    xref:EVP_PKEY.adoc[EVP&lowbar;PKEY]* pkey,
    xref:EVP_MD.adoc[EVP&lowbar;MD] const* md,
    xref:OSSL_LIB_CTX.adoc[OSSL&lowbar;LIB&lowbar;CTX]* libctx,
    char const* propq);
----

== Return Value

1 on success, or 0 on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *it*
| ASN&period;1 item describing `data&period;`
| *algor1*
| First AlgorithmIdentifier to fill (for example signatureAlgorithm), or NULL&period;
| *algor2*
| Optional second AlgorithmIdentifier to fill, or NULL&period;
| *signature*
| BIT STRING that receives the signature bytes&period;
| *data*
| Object whose DER encoding is signed&period;
| *id*
| Optional ASN&period;1 OCTET STRING identity &sol; SM2&hyphen;id parameter, or NULL&period;
| *pkey*
| Private key used to create the signature&period;
| *md*
| Digest method, or NULL to use the key&hyphen;type default&period;
| *libctx*
| Library context for algorithm fetches, or NULL for the default&period;
| *propq*
| Property query for algorithm fetches, or NULL&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
