PKCS12_ITEM_DECRYPT_D2I(3ossl)
π PKCS12_ITEM_DECRYPT_D2I π
okay bestie, so this is the <openssl/pkcs12.h> page from the OpenSSL manual (section 3ossl, as you can probs tell from the name up top β¨). It's all about encrypting and decrypting PKCS12 items, and honestly? Lowkey iconic. 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 π«Ά
πΈ 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);
π DESCRIPTION π
so PKCS12_item_decrypt_d2i() and PKCS12_item_decrypt_d2i_ex() decrypt an octet string that's holding an ASN.1 encoded object, using the algorithm algor and the password pass with length passlen. And listen β if zbuf is nonzero, the output buffer gets zeroed after the decrypt. Cleanup era π§Ήβ¨
Then PKCS12_item_i2d_encrypt() and PKCS12_item_i2d_encrypt_ex() do the reverse glow-up: they encrypt an ASN.1 object it using the algorithm algor and password pass of length passlen, and hand you back the encoded object in obj. And yeah β if zbuf is nonzero, the buffer holding the input encoding gets zeroed after the encrypt. No leftover crumbs, periodt π
And the functions ending in _ex()? Those are the ones that let you bring a library context ctx and a property query propq to the party, so you can pick which algorithm implementations get used. Choose-your-own-adventure but make it crypto π
not me specifying propq every single time⦠it's giving main character energy fr fr
π₯ RETURN VALUES π₯
PKCS12_item_decrypt_d2i()andPKCS12_item_decrypt_d2i_ex()β return the decrypted object π, orNULLif something went wrong πPKCS12_item_i2d_encrypt()andPKCS12_item_i2d_encrypt_ex()β return the encrypted data as an ASN.1 Octet String π¦, orNULLif something went wrong π
π¦ SEE ALSO π¦
PKCS12_pbe_crypt_ex(3), PKCS8_encrypt_ex(3) β go read those too bestie, iykyk π
π HISTORY π
PKCS12_item_decrypt_d2i_ex() and PKCS12_item_i2d_encrypt_ex() were added in OpenSSL 3.0. So if you're on anything older, those two simply did not exist yet β she was born in 3.0, no cap β
π COPYRIGHT π
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 π mwah, go zero those buffers π
OpenSSL 3.5.9, dated 2026-09-29 β this was PKCS12_ITEM_DECRYPT_D2I(3ossl), signing off π¦β¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms