PKCS12_ADD1_ATTR_BY_NID(3SSL)
π NAME π
ok so bestie, meet the duo: PKCS12_add1_attr_by_NID and PKCS12_add1_attr_by_txt β they add an attribute to a PKCS#12 safeBag structure. that's it, that's the whole job, and they do it flawlessly, no cap. β¨
(this is the 3SSL man page, for the OpenSSL crowd β iykyk πΈ)
π SYNOPSIS π
#include <openssl/pkcs12.h>
int PKCS12_add1_attr_by_NID(PKCS12_SAFEBAG *bag, int nid, int type,
const unsigned char *bytes, int len);
int PKCS12_add1_attr_by_txt(PKCS12_SAFEBAG *bag, const char *attrname, int type,
const unsigned char *bytes, int len);
literally just two little functions, both returning int, both so well-behaved π«Ά
π DESCRIPTION π
okay so here's the tea: these functions add a PKCS#12 Attribute to the Attribute Set of the bag. the bag in question being your PKCS12_SAFEBAG. she's getting accessories, and honestly? the bag ate. π
PKCS12_add1_attr_by_NID() adds an attribute of type nid with a value of ASN1 type type constructed using len bytes from bytes. so: you hand her a NID, a type, a chunk of bytes, and how many of those bytes matter β and she builds the value for you. iconic behaviour π
PKCS12_add1_attr_by_txt() does the exact same glow-up, except you give her an attribute name as text: it adds an attribute of type attrname with a value of ASN1 type type constructed using len bytes from bytes. same energy, different way in. slay β¨
π NOTES π
major heads up bestie: these functions do not check whether an existing attribute of the same type is present. π¨ there can be multiple attributes with the same type assigned to a safeBag. she's not gatekeeping, she's not deduping β she just adds, periodt. so if you call her twice with the same type, you get two. that's the vibe. π
also β both functions were added in OpenSSL 3.0. so if you're on something older, they simply do not exist for you, sorry babe π
β RETURN VALUES β
super simple, no plot twist:
- a return value of
1means success β she ate π₯ - a return value of
0means failure β it's giving nothing π
π¦ SEE ALSO π¦
PKCS12_create(3)β go read her too, bestie πΈ
π COPYRIGHT π
Copyright 2020 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, you're officially educated, go forth and add attributes responsibly πβ¨
this was OpenSSL 4.0.3, dated 2026-09-29, straight from the PKCS12_ADD1_ATTR_BY_NID(3SSL) page β stay hydrated, read your man pages, and remember: the bag always deserves a little treat ππ«Άπ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms