Module x509.req

x509.req module to mapping X509_REQ to lua object, creates and processes certificate requests (CSRs) in PKCS#10 format.

Usage:

    req = require'openssl'.x509.req
    

Functions

read (input[, format='auto']) read x509_req from string or bio input
new ([subject[, extensions[, attributes[, pkey[, md_alg='sha1WithRSAEncryption']]]]]) create or generate a new x509_req object.

Class x509_req

x509_req:to_x509 (csr, prikey[, days=365[, md_alg='sha256']]) convert x509_req to x509 object and sign it
x509_req:export ([format='pem']) export x509_req to string
x509_req:digest ([md_alg='sha256']) get digest of x509_req
x509_req:check (pkey) check x509_req with evp_pkey
x509_req:dup () clone x509_req object
x509_req:verify () verify x509_req signature
x509_req:sign (pkey, md) sign x509_req object
x509_req:parse ([default=true]) parse x509_req object as table
x509_req:public () get public key
x509_req:public (pubkey) set public key
x509_req:version () get version key
x509_req:version (version) set version key
x509_req:subject () get subject x509_name object
x509_req:subject (subject) set subject x509_name object
x509_req:extensions ([asobject=false]) get extensions of x509_req object
x509_req:extensions (extensions) set extension of x509_req object
x509_req:attribute (location, nil) remove attribute object from location
x509_req:attribute (location) get attribute object from location
x509_req:attribute (attribute) add attribute to x509_req object
x509_req:attr_count () get total attribute count in x509_req object


Functions

read (input[, format='auto'])
read x509_req from string or bio input

Parameters:

  • input bio or string input data
  • format string support ‘auto’,‘pem’,‘der’ (default 'auto')

Returns:

    x509_req certificate sign request object
new ([subject[, extensions[, attributes[, pkey[, md_alg='sha1WithRSAEncryption']]]]])
create or generate a new x509_req object. Note if not give evp_pkey, will create a new x509_req object,or will generate a signed x509_req object.

Parameters:

  • subject x509_name subject name set to x509_req (optional)
  • extensions stack_of_x509_extension add to x509_req (optional)
  • attributes stack_of_x509_attribute add to x509_req (optional)
  • pkey evp_pkey private key sign the x509_req, and set as public key (optional)
  • md_alg evp_digest or string , only used when pkey exist, and should fellow pkey (default 'sha1WithRSAEncryption')

Returns:

    x509_req certificate sign request object

See also:

Class x509_req

openssl.x509_req object
x509_req:to_x509 (csr, prikey[, days=365[, md_alg='sha256']])
convert x509_req to x509 object and sign it

Parameters:

  • csr x509_req
  • prikey evp_pkey
  • days number (default 365)
  • md_alg evp_md or string default use sha256 (default 'sha256')

Returns:

    x509 object not signed
x509_req:export ([format='pem'])
export x509_req to string

Parameters:

  • format string (default 'pem')

Returns:

    string
x509_req:digest ([md_alg='sha256'])
get digest of x509_req

Parameters:

  • md_alg evp_md or string default use sha256 (default 'sha256')

Returns:

    string digest result
x509_req:check (pkey)
check x509_req with evp_pkey

Parameters:

  • pkey evp_pkey

Returns:

    boolean result true for check pass
x509_req:dup ()
clone x509_req object

Returns:

    x509_req object
x509_req:verify ()
verify x509_req signature

Returns:

    boolean result true for verify pass
x509_req:sign (pkey, md)
sign x509_req object

Parameters:

  • pkey evp_pkey private key which to sign x509_req object
  • md number, string or evp_md message digest alg used to sign

Returns:

    boolean result true for suceess
x509_req:parse ([default=true])
parse x509_req object as table

Parameters:

  • default shortname will use short object name (default true)

Returns:

    table result
x509_req:public ()
get public key

Returns:

    evp_pkey public key
x509_req:public (pubkey)
set public key

Parameters:

  • pubkey evp_pkey public key set to x509_req

Returns:

    boolean result
x509_req:version ()
get version key

Returns:

    integer
x509_req:version (version)
set version key

Parameters:

  • version integer

Returns:

    boolean result
x509_req:subject ()
get subject x509_name object

Returns:

    x509_name
x509_req:subject (subject)
set subject x509_name object

Parameters:

  • subject x509_name

Returns:

    boolean result
x509_req:extensions ([asobject=false])
get extensions of x509_req object

Parameters:

  • asobject boolean , true for return as stack_of_x509_extension or as table (default false)

Returns:

  1. stack_of_x509_extension object when param set true
  2. table contain all x509_extension when param set false or nothing
x509_req:extensions (extensions)
set extension of x509_req object

Parameters:

  • extensions stack_of_x509_extension

Returns:

    boolean result true for success
x509_req:attribute (location, nil)
remove attribute object from location

Parameters:

  • location integer
  • nil nil , nil not none

Returns:

    x509_attribute attribute removed
x509_req:attribute (location)
get attribute object from location

Parameters:

  • location integer

Returns:

    x509_attribute attribute
x509_req:attribute (attribute)
add attribute to x509_req object

Parameters:

  • attribute x509_attribute attribute to add

Returns:

    boolean result
x509_req:attr_count ()
get total attribute count in x509_req object

Returns:

    integer
generated by LDoc 1.5.0 Last updated 2024-05-16 23:31:39