hx509_cms(3)
π NAME π
hx509_cms β the hx509 CMS/pkcs7 functions, bestie. That's the whole vibe. It's a page from the Heimdal x509 library manual, and we're gonna go through every single one of these functions together, no skips, no cap. π
β¨ SYNOPSIS β¨
Okay so here's the full cast, like the group chat roster. Every single one of these signatures, exactly as they are:
int hx509_cms_wrap_ContentInfo (const heim_oid *oid, const
heim_octet_string *buf, heim_octet_string *res)
int hx509_cms_unwrap_ContentInfo (const heim_octet_string *in, heim_oid
*oid, heim_octet_string *out, int *have_data)
int hx509_cms_unenvelope (hx509_context context, hx509_certs certs, int
flags, const void *data, size_t length, const heim_octet_string
*encryptedContent, time_t time_now, heim_oid *contentType,
heim_octet_string *content)
int hx509_cms_envelope_1 (hx509_context context, int flags, hx509_cert
cert, const void *data, size_t length, const heim_oid
*encryption_type, const heim_oid *contentType, heim_octet_string
*content)
int hx509_cms_verify_signed (hx509_context context, hx509_verify_ctx
ctx, unsigned int flags, const void *data, size_t length, const
heim_octet_string *signedContent, hx509_certs pool, heim_oid
*contentType, heim_octet_string *content, hx509_certs *signer_certs)
int hx509_cms_create_signed_1 (hx509_context context, int flags, const
heim_oid *eContentType, const void *data, size_t length, const
AlgorithmIdentifier *digest_alg, hx509_cert cert, hx509_peer_info
peer, hx509_certs anchors, hx509_certs pool, heim_octet_string
*signed_data)
These are the functions. Yes bestie, they're C, they're long, they're giving main character energy. π«Ά
π DETAILED DESCRIPTION π
So like, for the actual description and examples? Go check out the CMS/PKCS7 message functions. That's where the tea is. This page is just the function-by-function receipts. π
πΈ FUNCTION DOCUMENTATION πΈ
π¦ int hx509_cms_create_signed_1
int hx509_cms_create_signed_1 (hx509_context context, int flags, const
heim_oid * eContentType, const void * data, size_t length, const
AlgorithmIdentifier * digest_alg, hx509_cert cert, hx509_peer_info peer,
hx509_certs anchors, hx509_certs pool, heim_octet_string * signed_data)
Decode SignedData and verify that the signature is correct. (Yes, that's literally what the original says for this one β we're not editing, we're reporting. π)
Parameters β okay, going down the list, every single one:
contextβ A hx509 context.flagsβ (no description given, it's just there, living its truth.)eContentTypeβ the type of the data.dataβ data to sign.lengthβ length of the data thatdatapoint to.digest_algβ digest algorithm to use, useNULLto get the default or the peer determined algorithm.certβ certificate to use for sign the data.peerβ info about the peer the message to send the message to, like what digest algorithm to use.anchorsβ trust anchors that the client will use, used to polulate the certificates included in the message.poolβ certificates to use in try to build the path to the trust anchors.signed_dataβ the output of the function, free withder_free_octet_string().
Returns β Returns an hx509 error code. β¨
π¦ int hx509_cms_envelope_1
int hx509_cms_envelope_1 (hx509_context context, int flags, hx509_cert cert,
const void * data, size_t length, const heim_oid * encryption_type,
const heim_oid * contentType, heim_octet_string * content)
Encrypt end encode EnvelopedData.
Encrypt and encode EnvelopedData. The data is encrypted with a random key and the the random key is encrypted with the certificates private key. This limits what private key type can be used to RSA. π
Parameters:
contextβ A hx509 context.flagsβ flags to control the behavior.HX509_CMS_EV_NO_KU_CHECKβ Don't check KU on certificateHX509_CMS_EV_ALLOW_WEAKβ Allow weak crytpoHX509_CMS_EV_ID_NAMEβ prefer issuer name and serial number
certβ Certificate to encrypt the EnvelopedData encryption key with.dataβ pointer the data to encrypt.lengthβ length of the data thatdatapoint to.encryption_typeβ Encryption cipher to use for the bulk data, useNULLto get default.contentTypeβ type of the data that is encrypted.contentβ the output of the function, free withder_free_octet_string().
Returns β an hx509 error code. π
π¦ int hx509_cms_unenvelope
int hx509_cms_unenvelope (hx509_context context, hx509_certs certs, int
flags, const void * data, size_t length, const heim_octet_string *
encryptedContent, time_t time_now, heim_oid * contentType,
heim_octet_string * content)
Decode and unencrypt EnvelopedData.
Extract data and parameteres from from the EnvelopedData. Also supports using detached EnvelopedData. Obsessed with the flexibility honestly. π
Parameters:
contextβ A hx509 context.certsβ Certificate that can decrypt the EnvelopedData encryption key.flagsβHX509_CMS_UEflags to control the behavior.dataβ pointer the structure the contains the DER/BER encoded EnvelopedData stucture.lengthβ length of the data thatdatapoint to.encryptedContentβ in case of detached signature, this contains the actual encrypted data, othersize its should beNULL.time_nowβ set the current time, if zero the library uses now as the date.contentTypeβ output type oid, should be freed withder_free_oid().contentβ the data, free withder_free_octet_string().
Returns β an hx509 error code. β¨
π¦ int hx509_cms_unwrap_ContentInfo
int hx509_cms_unwrap_ContentInfo (const heim_octet_string * in, heim_oid *
oid, heim_octet_string * out, int * have_data)
Decode an ContentInfo and unwrap data and oid it.
Parameters:
inβ the encoded buffer.oidβ type of the content.outβ data to be wrapped.have_dataβ since the data is optional, this flags show dthe diffrence between no data and the zero length data. (Very important distinction bestie, like "no thoughts" vs "one (1) thought, empty" π)
Returns β Returns an hx509 error code. π«Ά
π¦ int hx509_cms_verify_signed
int hx509_cms_verify_signed (hx509_context context, hx509_verify_ctx ctx,
unsigned int flags, const void * data, size_t length, const
heim_octet_string * signedContent, hx509_certs pool, heim_oid *
contentType, heim_octet_string * content, hx509_certs * signer_certs)
Decode SignedData and verify that the signature is correct.
Parameters:
contextβ A hx509 context.ctxβ a hx509 verify context.flagsβ to control the behaivor of the function.HX509_CMS_VS_NO_KU_CHECKβ Don't check KeyUsageHX509_CMS_VS_ALLOW_DATA_OID_MISMATCHβ allow oid mismatchHX509_CMS_VS_ALLOW_ZERO_SIGNERβ no signer, see below.
dataβ pointer to CMS SignedData encoded data.lengthβ length of the data thatdatapoint to.signedContentβ external data used for signature.poolβ certificate pool to build certificates paths.contentTypeβ free withder_free_oid().contentβ the output of the function, free withder_free_octet_string().signer_certsβ list of the cerficates used to sign this request, free withhx509_certs_free().
Returns β an hx509 error code.
Okay now the β¨special flag loreβ¨, and these are IMPORTANT, so listen up:
If HX509_CMS_VS_NO_KU_CHECK is set, allow more liberal search for matching certificates by not considering KeyUsage bits on the certificates.
If HX509_CMS_VS_ALLOW_DATA_OID_MISMATCH, allow encapContentInfo mismatch with the oid in signedAttributes (or if no signedAttributes where use, pkcs7-data oid). This is only needed to work with broken CMS implementations that doesn't follow CMS signedAttributes rules. Like bestie... do better. π
If HX509_CMS_VS_NO_VALIDATE flags is set, do not verify the signing certificates and leave that up to the caller. (You're on your own, good luck, you got this π)
If HX509_CMS_VS_ALLOW_ZERO_SIGNER is set, allow empty SignerInfo (no signatures). If SignedData have no signatures, the function will return 0 with signer_certs set to NULL. Zero signers is allowed by the standard, but since its only useful in corner cases, it make into a flag that the caller have to turn on. π
π¦ int hx509_cms_wrap_ContentInfo
int hx509_cms_wrap_ContentInfo (const heim_oid * oid, const
heim_octet_string * buf, heim_octet_string * res)
Wrap data and oid in a ContentInfo and encode it.
Parameters:
oidβ type of the content.bufβ data to be wrapped. If aNULLpointer is passed in, the optional content field in the ContentInfo is not going be filled in.resβ the encoded buffer, the result should be freed withder_free_octet_string().
Returns β Returns an hx509 error code. πΈ
π AUTHOR π
Generated automatically by Doxygen for Heimdal x509 library from the source code. Not me, bestie β the robots wrote this one. π€β¨
And that's the whole page, fr fr. π This was Version 7.8.0, dated Tue Nov 15 2022, and the manual is hx509_cms(3) β that's the Heimdal x509 library's very own page. Now go build something iconic with it. ππ¦
π¦ where this page comes from
- alpine 3.22: heimdal-doc 7.8.0-r4 Β· BSD-3-Clause
- alpine 3.23: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- alpine 3.24: heimdal-doc 7.8.0-r5 Β· BSD-3-Clause
- epel 10: heimdal-devel 7.8.0-26.el10_2 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- epel 9: heimdal-devel 7.8.0-5.el9 Β· BSD and MIT
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 43: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-26.fc43 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- fedora 44: heimdal-devel 7.8.0-28.fc44 Β· BSD-2-Clause AND BSD-3-Clause AND HPND-export-US AND HPND-export2-US AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms