Module x509.attribute

x509.attribute module to mapping X509_ATTRIBUTE to lua object.

Usage:

    attr = require('openssl').x509.attribute
    

Functions

new_attribute (attribute) Create x509_attribute object

Tables

x509_attribute_param_table x509_attribute contrust param table.
asn1_type_table asn1_type object as table
x509_attribute_info_table x509_attribute infomation table

Class x509_attribute

x509_attribute:info () get infomation table of x509_attribute.
x509_attribute:dup () clone then asn1_attribute
x509_attribute:data (idx, attrtype) get type of x509_attribute
x509_attribute:data (attrtype, data) set type of x509_attribute
x509_attribute:type ([location]) get type of x509_attribute.
x509_attribute:object () get asn1_object of x509_attribute.
x509_attribute:object (obj) set asn1_object for x509_attribute.


Functions

new_attribute (attribute)
Create x509_attribute object

Parameters:

  • attribute table attribute table with object, type and value fields

Returns:

    openssl.x509_attribute X509_ATTRIBUTE object on success

Or

  1. nil on error
  2. string error message — @see openssl/x509.h:X509_ATTRIBUTE_ — @see OpenSSL function: X509_ATTRIBUTE_new

Usage:

    local attr = x509.attribute.new_attribute({
      object = '1.2.3.4.5',
      type = 'utf8',
      value = 'test value'
    })

Tables

x509_attribute_param_table
x509_attribute contrust param table.

Fields:

  • object string, integer or asn1_object identify a asn1_object
  • type string or integer same with type in asn1.new_string
  • value string or asn1_object value of attribute

Usage:

    xattr = x509.attribute.new_attribute {
      object = asn1_object,
      type = Nid_or_String,
      value = string or asn1_string value
    }
asn1_type_table
asn1_type object as table

Fields:

  • value string value data
  • type string type of value
  • format string value is ‘der’, only exist when type is not in ‘bit’,‘bmp’,‘octet’
x509_attribute_info_table
x509_attribute infomation table

Fields:

  • object asn1_object or object of asn1_object
  • single boolean true for single value
  • value table if single, value is asn1_type or array have asn1_type node table

Class x509_attribute

openssl.x509_attribute object
x509_attribute:info ()
get infomation table of x509_attribute.

Returns:

    table info x509_attribute infomation as table — @see OpenSSL function: X509_ATTRIBUTE_get0_type
x509_attribute:dup ()
clone then asn1_attribute

Returns:

    x509_attribute attr clone of x509_attribute
x509_attribute:data (idx, attrtype)
get type of x509_attribute

Parameters:

  • idx integer location want to get type
  • attrtype string attribute type

Returns:

    asn1_string
x509_attribute:data (attrtype, data)
set type of x509_attribute

Parameters:

  • attrtype string attribute type
  • data string set to asn1_attr

Returns:

    boolean result true for success and others for fail
x509_attribute:type ([location])
get type of x509_attribute.

Parameters:

  • location integer which location to get type, default is 0 (optional)

Returns:

  1. table asn1_type asn1_type as table info
  2. nil nil, fail return nothing — @see openssl/asn1.h:ASN1_TYPE_
x509_attribute:object ()
get asn1_object of x509_attribute.

Returns:

    openssl.asn1_object object of x509_attribute
x509_attribute:object (obj)
set asn1_object for x509_attribute.

Parameters:

  • obj openssl.asn1_object

Returns:

  1. boolean true for success
  2. nil when occure error, and followed by error message
generated by LDoc 1.5.0 Last updated 2026-02-12 13:58:19