PKCS12_ADD1_ATTR_BY_NID(3ossl)
π
PKCS12_ADD1_ATTR_BY_NID β the 3ossl girlies' guide π
okay so bestie, welcome to another OpenSSL manpage, this one lives in the 3ossl section and honestly? it's a short one, we love a low-effort queen. let's get into it π
β¨ NAME β¨
PKCS12_add1_attr_by_NID, PKCS12_add1_attr_by_txt β the two functions that let you add an attribute to a PKCS#12 safeBag structure. yes, safeBag. that's really the name. not me giggling π
πΈ SYNOPSIS πΈ
she's a C girly, so you know we're including headers first, no cap:
#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);
copy that exactly bestie, character for character, I'm not playing π«Ά
π¦ DESCRIPTION π¦
so basically, both of these functions add a PKCS#12 Attribute to the Attribute Set of the bag. that's it, that's the whole vibe. two little functions, one big job β¨
PKCS12_add1_attr_by_NID()β adds an attribute of typenidwith a value of ASN1 typetype, constructed usinglenbytes frombytes. she takes the number route, iykyk π’PKCS12_add1_attr_by_txt()β adds an attribute of typeattrnamewith a value of ASN1 typetype, constructed usinglenbytes frombytes. same energy, but you're naming the attribute with a string instead π€
literally the same destination, two different roads to get there. main character energy from both of them fr fr π
π NOTES π
okay important, listen up bestie π’
- these functions do not check whether an existing attribute of the same type is present. so like, no vibe check, no duplicate filter, nothing. it's giving "i own this bag" π
- there can be multiple attributes with the same type assigned to a safeBag. yes, multiple. the bag is a little hoarder and honestly we support her π
also, both functions were added in OpenSSL 3.0, so if you're on something older, she does not exist and you will simply have to cope π
π RETURN VALUES π
short and sweet, just how we like it:
1means success, ate that, no crumbs π₯0means failure, and we do NOT stan π
π SEE ALSO π
go look at PKCS12_create(3) if you want the whole friend group, bestie, because these functions are just the supporting cast π«Ά
π 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>.
like, read the license bestie, it's literally the rules of the group chat πΈ
and that's the whole page! β¨ this iconic little writeup is from version 3.5.0, dated 2026-09-25, and it's filed under PKCS12_ADD1_ATTR_BY_NID(3ossl) β mwah, go take care of your safeBags, xoxo ππ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms