-*- mode: troff; coding: utf-8 -*-
Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
Standard preamble:
========================================================================
..
.... \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
. ds C` "" . ds C' "" 'br\} . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF ========================================================================
Title "X509_ATTRIBUTE 3"
way too many mistakes in technical documents.
The X509_ATTRIBUTE object is used to represent the ASN.1 Attribute as defined in RFC 5280, i.e.
.Vb 3 Attribute ::= SEQUENCE { type AttributeType, values SET OF AttributeValue } \& AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY -- DEFINED BY AttributeType .Ve
For example CMS defines the signing-time attribute as:
.Vb 2 id-signingTime OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 5 } \& SigningTime ::= Time \& Time ::= CHOICE { utcTime UTCTime, generalizedTime GeneralizedTime } .Ve
In OpenSSL AttributeType maps to an ASN1_OBJECT object and AttributeValue maps to a list of ASN1_TYPE objects.
The following functions are used for X509_ATTRIBUTE objects.
\fBX509at_get_attr_by_OBJ() finds the location of the first matching object obj in a list of attributes sk. The search starts at the position after lastpos. If the returned value is positive then it can be used on the next call to \fBX509at_get_attr_by_OBJ() as the value of lastpos in order to iterate through the remaining attributes. lastpos can be set to any negative value on the first call, in order to start searching from the start of the list.
\fBX509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.
\fBX509at_get_attr() returns the X509_ATTRIBUTE object at index loc in the list of attributes x. loc should be in the range from 0 to \fBX509at_get_attr_count() - 1.
\fBX509at_delete_attr() removes the X509_ATTRIBUTE object at index loc in the list of attributes x.
\fBX509at_add1_attr() pushes a copy of the passed in X509_ATTRIBUTE object to the list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new list is created, otherwise it uses the passed in list. An error will occur if an existing attribute (with the same attribute type) already exists in the attribute list.
\fBX509at_add1_attr_by_OBJ() creates a new X509_ATTRIBUTE using \fBX509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() to assign a new \fIobj with type type and data bytes of length len and then pushes it to the attribute list x. Both x and attr must be non NULL or an error will occur. If *x is NULL then a new attribute list is created. If obj already exists in the attribute list then an error occurs.
\fBX509at_add1_attr_by_NID() is similar to X509at_add1_attr_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.
\fBX509at_add1_attr_by_txt() is similar to X509at_add1_attr_by_OBJ() except that it passes a name attrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.
\fBX509_ATTRIBUTE_set1_object() assigns a ASN1_OBJECT obj to the attribute attr. If attr contained an existing ASN1_OBJECT then it is freed. An error occurs if either attr or obj are NULL, or if the passed in obj cannot be duplicated.
\fBX509_ATTRIBUTE_set1_data() pushes a new ASN1_TYPE object onto the attr attributes list. The new object is assigned a copy of the data in data of size len. If attrtype has flag MBSTRING_FLAG set then a table lookup using the \fIattr attributes NID is used to set an ASN1_STRING using \fBASN1_STRING_set_by_NID(), and the passed in data must be in the format required for that object type or an error will occur. If len is not -1 then internally ASN1_STRING_type_new() is used with the passed in attrtype. If attrtype is 0 the call does nothing except return 1.
\fBX509_ATTRIBUTE_create() creates a new X509_ATTRIBUTE using the nid to set the ASN1_OBJECT OID and the atrtype and value to set the \fBASN1_TYPE.
\fBX509_ATTRIBUTE_create_by_OBJ() uses X509_ATTRIBUTE_set1_object() and \fBX509_ATTRIBUTE_set1_data() to assign a new obj with type atrtype and data data of length len. If the passed in attribute attr OR *attr is NULL then a new X509_ATTRIBUTE will be returned, otherwise the passed in \fBX509_ATTRIBUTE is used. Note that the ASN1_OBJECT obj is pushed onto the attributes existing list of objects, which could be an issue if the attributes <ASN1_OBJECT> was different.
\fBX509_ATTRIBUTE_create_by_NID() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes the numerical identifier (NID) nid associated with the object. See <openssl/obj_mac.h> for a list of NID_*.
\fBX509_ATTRIBUTE_create_by_txt() is similar to X509_ATTRIBUTE_create_by_OBJ() except that it passes a name atrname associated with the object. See <openssl/obj_mac.h> for a list of SN_* names.
\fBX509_ATTRIBUTE_count() returns the number of ASN1_TYPE objects in an attribute attr.
\fBX509_ATTRIBUTE_get0_type() returns the ASN1_TYPE object at index idx in the attribute list attr. idx should be in the range of 0 to X509_ATTRIBUTE_count() - 1 or an error will occur.
\fBX509_ATTRIBUTE_get0_data() returns the data of an ASN1_TYPE object at index idx in the attribute attr. data is unused and can be set to NULL. An error will occur if the attribute type atrtype does not match the type of the ASN1_TYPE object at index idx OR if atrtype is either \fBV_ASN1_BOOLEAN or V_ASN1_NULL OR if the idx is not in the range 0 to X509_ATTRIBUTE_count() - 1.
\fBX509at_get0_data_by_OBJ() finds the first attribute in an attribute list x that matches the obj starting at index lastpos and returns the data retrieved from the found attributes first ASN1_TYPE object. An error will occur if the attribute type type does not match the type of the ASN1_TYPE object OR if type is either V_ASN1_BOOLEAN or V_ASN1_NULL OR the attribute is not found. If lastpos is less than -1 then an error will occur if there are multiple objects in the list x that match obj. If lastpos is less than -2 then an error will occur if there is more than one ASN1_TYPE object in the found attribute.
\fBX509at_get_attr_by_OBJ() returns -1 if either the list is empty OR the object is not found, otherwise it returns the location of the object in the list.
\fBX509at_get_attr_by_NID() is similar to X509at_get_attr_by_OBJ(), except that it returns -2 if the nid is not known by OpenSSL.
\fBX509at_get_attr() returns either an X509_ATTRIBUTE or NULL if there is a error.
\fBX509at_delete_attr() returns either the removed X509_ATTRIBUTE or NULL if there is a error.
\fBX509_ATTRIBUTE_count() returns -1 on error, otherwise it returns the number of ASN1_TYPE elements.
\fBX509_ATTRIBUTE_get0_type() returns NULL on error, otherwise it returns a \fBASN1_TYPE object.
\fBX509_ATTRIBUTE_get0_data() returns NULL if an error occurs, otherwise it returns the data associated with an ASN1_TYPE object.
\fBX509_ATTRIBUTE_set1_object() and X509_ATTRIBUTE_set1_data() returns 1 on success, or 0 otherwise.
\fBX509_ATTRIBUTE_create(), X509_ATTRIBUTE_create_by_OBJ(), \fBX509_ATTRIBUTE_create_by_NID() and X509_ATTRIBUTE_create_by_txt() return either a X509_ATTRIBUTE on success, or NULL if there is a error.
\fBX509at_add1_attr(), X509at_add1_attr_by_OBJ(), X509at_add1_attr_by_NID() and \fBX509at_add1_attr_by_txt() return NULL on error, otherwise they return a list of X509_ATTRIBUTE.
\fBX509at_get0_data_by_OBJ() returns the data retrieved from the found attributes first ASN1_TYPE object, or NULL if an error occurs.
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>.