PKCS12_ITEM_DECRYPT_D2I(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… PKCS12_ITEM_DECRYPT_D2I πŸ’…

okay bestie so this is the OpenSSL manual page for PKCS12_ITEM_DECRYPT_D2I(3ossl) β€” yes that's the whole vibe, section 3ossl, we're in the library-functions part of the man pages. it's giving "crypto but make it cute". let's get into it πŸŽ€


✨ NAME ✨

PKCS12_item_decrypt_d2i, PKCS12_item_decrypt_d2i_ex, PKCS12_item_i2d_encrypt, PKCS12_item_i2d_encrypt_ex β€” the PKCS12 item encrypt/decrypt girlies. they do exactly what the name says: encrypt an item, decrypt an item, live laugh love πŸ’–


🌸 SYNOPSIS 🌸

#include <openssl/pkcs12.h>

void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,
                              const char *pass, int passlen,
                              const ASN1_OCTET_STRING *oct, int zbuf);
void *PKCS12_item_decrypt_d2i_ex(const X509_ALGOR *algor, const ASN1_ITEM *it,
                                 const char *pass, int passlen,
                                 const ASN1_OCTET_STRING *oct, int zbuf,
                                 OSSL_LIB_CTX *libctx,
                                 const char *propq);
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,
                                           const ASN1_ITEM *it,
                                           const char *pass, int passlen,
                                           void *obj, int zbuf);
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt_ex(X509_ALGOR *algor,
                                              const ASN1_ITEM *it,
                                              const char *pass, int passlen,
                                              void *obj, int zbuf,
                                              OSSL_LIB_CTX *ctx,
                                              const char *propq);

like, copy that verbatim bestie, don't be doing typo edits on me πŸ™ˆ


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜•

PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() decrypt an octet string that's holding an ASN.1 encoded object β€” they use the algorithm algor and the password pass which is passlen long. and bestie, listen: if zbuf is nonzero, then the output buffer gets zeroed after the decrypt. that's the "clean up after yourself" energy, we love to see it πŸ’…

PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() go the other way β€” they encrypt an ASN.1 object it using the algorithm algor and the password pass of length passlen, returning an encoded object in obj. and same deal: if zbuf is nonzero, the buffer containing the input encoding gets zeroed after the encrypt. scrubbing the evidence, iconic πŸ”₯

and the functions ending in _ex()? those are the glow-up versions β€” they let a library context ctx and a property query propq be used to pick which algorithm implementations get used. main character energy for real πŸ‘‘


πŸ‘‘ RETURN VALUES πŸ‘‘

  • PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() hand you back the decrypted object. or NULL if something went wrong 😭
  • PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() hand you back the encrypted data as an ASN1_OCTET_STRING. or NULL if something went wrong 😭

like, NULL is the vibe check failing. check your inputs bestie 🫢


🌈 SEE ALSO 🌈

go read those next, iykyk πŸ’œ


⭐ HISTORY ⭐

PKCS12_item_decrypt_d2i_ex() and PKCS12_item_i2d_encrypt_ex() are the new girls β€” they were added in OpenSSL 3.0. periodt. ✨


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


and that's the whole page bestie πŸŽ€ this was 3.5.0, dated 2026-09-25 β€” mwah, go encrypt something responsibly πŸ’–πŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from