Module x509.name
x509.name module to mapping X509_NAME to lua object.
Usage:
name = require('openssl').x509.name
Functions
new (array[, utf8]) | Create x509_name object |
d2i (content) | Create x509_name from der string |
Tables
x509_extension_info_table | x509_name infomation table other field is number type, and value table is alter name.(I not understand clearly) |
Class x509_name
x509_name:oneline () | get oneline of x509_name. |
x509_name:hash () | get hash code of x509_name |
x509_name:digest (md) | get digest of x509_name |
x509_name:print (out[, indent[, flags]]) | print x509_name to bio object |
x509_name:info ([asobject=false]) | return x509_name as table |
x509_name:cmp (another) | compare two x509_name |
x509_name:dup () | make a clone of x509_name |
x509_name:i2d () | get DER encoded string of x509_name. |
x509_name:entry_count () | get count in x509_name. |
x509_name:get_text (identid[, lastpos=-1]) | get text by given asn1_object or nid |
x509_name:get_entry (index[, asobject=false]) | get x509 name entry by index |
x509_name:add_entry (identid, data[, utf8]) | add name entry |
x509_name:delete_entry (location) | get index by give asn1_object or nid |
Functions
- new (array[, utf8])
-
Create x509_name object
Parameters:
- array table include name node
- utf8 boolean encode will be use default (optional)
Returns:
-
x509_name
mapping to X509_EXTENSION in openssl
Usage:
name = require'openssl'.x509.name subject = name.new{ {C='CN'}, {O='kkhub.com'}, {CN='zhaozg'} }
- d2i (content)
-
Create x509_name from der string
Parameters:
- content string DER encoded string
Returns:
-
x509_name
mapping to X509_NAME in openssl
Tables
- x509_extension_info_table
-
x509_name infomation table
other field is number type, and value table is alter name.(I not understand clearly)
Fields:
- object asn1_object or object of x509_name
- true boolean or critical for critical value
- as string or value octet string
Class x509_name
openssl.x509_name object
- x509_name:oneline ()
-
get oneline of x509_name.
Returns:
-
string
line, name as oneline text
- x509_name:hash ()
-
get hash code of x509_name
Returns:
-
integer
hash hash code of x509_name
- x509_name:digest (md)
-
get digest of x509_name
Parameters:
- md string, nid or openssl.evp_md method of digest
Returns:
-
string
digest digest value by given alg of x509_name
- x509_name:print (out[, indent[, flags]])
-
print x509_name to bio object
Parameters:
- out openssl.bio output bio object
- indent integer for output (optional)
- flags integer for output (optional)
Returns:
-
boolean
result, follow by error message
- x509_name:info ([asobject=false])
-
return x509_name as table
Parameters:
- asobject boolean table key will use asn1_object or short name of asn1_object (default false)
Returns:
-
table
names
See also:
- x509_name:cmp (another)
-
compare two x509_name
Parameters:
- another x509_name to compare with
Returns:
-
boolean
result true for equal or false
Usage:
name1 = name.new({...}) name2 = name1:dup() assert(name1:cmp(name2)==(name1==name2))
- x509_name:dup ()
-
make a clone of x509_name
Returns:
-
x509_name
clone
- x509_name:i2d ()
-
get DER encoded string of x509_name.
Returns:
-
string
der
- x509_name:entry_count ()
-
get count in x509_name.
Returns:
-
integer
count of x509_name
- x509_name:get_text (identid[, lastpos=-1])
-
get text by given asn1_object or nid
Parameters:
- identid string, integer or asn1_object for asn1_object
- lastpos number retrieve the next index after lastpos (default -1)
Returns:
-
string
text and followed by lastpos
- x509_name:get_entry (index[, asobject=false])
-
get x509 name entry by index
Parameters:
- index integer start from 0, and less than xn:entry_count()
- asobject boolean table key will use asn1_object or short name of asn1_object (default false)
Returns:
-
x509
name entry table
- x509_name:add_entry (identid, data[, utf8])
-
add name entry
Parameters:
- identid string, integer or asn1_object for asn1_object
- data string to add
- utf8 boolean true for use utf8 default (optional)
Returns:
-
boolean
result true for success or follow by error message
- x509_name:delete_entry (location)
-
get index by give asn1_object or nid
Parameters:
- location integer which name entry to delete
Returns:
- asn1_object object that delete name entry
- asn1_string value that delete name entry
Or
-
nil
delete nothing