OpenBSD manual page server

Manual Page Search Parameters

EVP_PKEY_ADD1_ATTR(3) Library Functions Manual EVP_PKEY_ADD1_ATTR(3)

EVP_PKEY_add1_attr, EVP_PKEY_add1_attr_by_OBJ, EVP_PKEY_add1_attr_by_NID, EVP_PKEY_add1_attr_by_txt, EVP_PKEY_delete_attr, EVP_PKEY_get_attr, EVP_PKEY_get_attr_count, EVP_PKEY_get_attr_by_OBJ, EVP_PKEY_get_attr_by_NIDX.501 Attributes of private keys

#include <openssl/x509.h>

int
EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);

int
EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type, const unsigned char *data, int len);

int
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, int nid, int type, const unsigned char *data, int len);

int
EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *name, int type, const unsigned char *data, int len);

X509_ATTRIBUTE *
EVP_PKEY_delete_attr(EVP_PKEY *key, int index);

X509_ATTRIBUTE *
EVP_PKEY_get_attr(const EVP_PKEY *key, int index);

int
EVP_PKEY_get_attr_count(const EVP_PKEY *key);

int
EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj, int start_after);

int
EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int start_after);

These functions support associating an array of X.501 Attributes with a private key. Such attributes can for example be included in PKCS#12 structures.

() appends a deep copy of the attr using X509at_add1_attr(3).

(), (), and () create a new X.501 Attribute object using X509_ATTRIBUTE_create_by_OBJ(3), X509_ATTRIBUTE_create_by_NID(3), or X509_ATTRIBUTE_create_by_txt(3), respectively, and append it using X509at_add1_attr(3).

() deletes the attribute with the zero-based index using X509at_delete_attr(3).

() returns the attribute with the zero-based index using X509at_get_attr(3).

() returns the number of attributes currently associated with the key using X509at_get_attr_count(3).

() and () search for an attribute of the type obj or nid using X509at_get_attr_by_OBJ(3) or X509at_get_attr_by_NID(3), respectively.

EVP_PKEY_add1_attr(), EVP_PKEY_add1_attr_by_OBJ(), EVP_PKEY_add1_attr_by_NID(), and EVP_PKEY_add1_attr_by_txt() return 1 for success or 0 for failure.

EVP_PKEY_delete_attr() and EVP_PKEY_get_attr() return the deleted or requested attribute or NULL if the requested index is negative or greater than or equal to the current number of attributes associated with the key.

EVP_PKEY_get_attr_count() returns the current number of attributes.

EVP_PKEY_get_attr_by_OBJ() and EVP_PKEY_get_attr_by_NID() return the index of the first attribute that has an index greater than start_after and a type matching obj or nid, respectively, or -1 on failure. In addition, EVP_PKEY_get_attr_by_NID() returns -2 if OBJ_nid2obj(3) fails on the requested nid.

EVP_PKEY_new(3), OBJ_nid2obj(3), PKCS12_create(3), X509_ATTRIBUTE_create_by_OBJ(3), X509_ATTRIBUTE_new(3), X509at_add1_attr(3), X509at_get_attr(3)

These functions first appeared in OpenSSL 0.9.8 and have been available since OpenBSD 4.5.

October 26, 2021 OpenBSD-7.5