CMS_GET1_RECEIPTREQUEST(3ossl)

πŸ’– NAME πŸ’–

okay so bestie, this is the CMS signed receipt request page β€” it covers CMS_ReceiptRequest_create0_ex, CMS_ReceiptRequest_create0, CMS_add1_ReceiptRequest, CMS_get1_ReceiptRequest, and CMS_ReceiptRequest_get0_values. it's from the OpenSSL manual, section 3ossl, and honestly? these are the functions that make signed receipts a whole thing. 🧾✨


✨ SYNOPSIS ✨

#include <openssl/cms.h>

CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
    unsigned char *id, int idlen, int allorfirst,
    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo,
    OSSL_LIB_CTX *libctx);
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(
    unsigned char *id, int idlen, int allorfirst,
    STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo);
int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr, ASN1_STRING **pcid,
                                    int *pallorfirst,
                                    STACK_OF(GENERAL_NAMES) **plist,
                                    STACK_OF(GENERAL_NAMES) **prto);

🌸 DESCRIPTION 🌸

CMS_ReceiptRequest_create0_ex() is the one that creates a signed receipt request structure. no cap. here's the tea on how it fills stuff in:

  • the signedContentIdentifier field gets set using id and idlen β€” but if id is NULL, it just gets set to 32 bytes of pseudo random data instead 🎲
  • 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 instead
  • the receiptsTo parameter specifies the receiptsTo field value
  • the library context libctx is used to find the public random generator πŸ‘‘

CMS_ReceiptRequest_create0() is literally the same vibe as CMS_ReceiptRequest_create0_ex() but it uses default values of NULL for the library context libctx. she's low maintenance like that. 🫢

The CMS_add1_ReceiptRequest() function adds a signed receipt request rr to the SignerInfo structure si. it's giving "adding to the group chat."

int CMS_get1_ReceiptRequest() goes looking for a signed receipt request in si, and if any is found it gets 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

πŸ“ NOTES πŸ“

for more details of the meaning of the fields, go read RFC2634. iykyk. πŸ“–

⚠️ the contents of a signed receipt should only be considered meaningful if the corresponding CMS_ContentInfo structure can be successfully verified using CMS_verify(). like, don't trust it otherwise bestie. verify first, always. πŸ’…

πŸ”₯ RETURN VALUES πŸ”₯

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 if 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. three moods, honestly. πŸ’€


πŸ‘€ SEE ALSO πŸ‘€


⭐ HISTORY ⭐

the function CMS_ReceiptRequest_create0_ex() was added in OpenSSL 3.0. she's new-ish, she's iconic, periodt. 🌈


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>.


okay that's the whole page bestie, hope it ate πŸ’– this was OpenSSL version 3.5.9, dated 2026-09-29, and yes, the manual name really is CMS_GET1_RECEIPTREQUEST(3ossl) β€” go forth and sign those receipts, main character. πŸ¦‹πŸ‘‘

πŸ“¦ where this page comes from