Module tch.crypto.x509
Lua C module exposing X.509 certificates.
Usage:
Example code: local x509 = require("tch.crypto.x509") local cert = x509.new_from_string(string_data) local shash = cert:subject_hash() cert:free()
Functions
new_from_string(certificate_data) | Create a new X.509 certificate object from a string. |
Class cert
cert:free() | Free the X.509 certificate. |
cert:subject_hash() | Subject hash from certificate. |
Functions
- new_from_string(certificate_data)
-
Create a new X.509 certificate object from a string.
Parameters:
- certificate_data string String data containing the certificate info in PEM format.
Returns:
-
cert
The newly created X.509 object from the given string.
Or
- nil
- string Error message.
Class cert
X.509 methods.
- cert:free()
- Free the X.509 certificate. It's not an error to free an object more than once. Calling methods on a freed certificate will result in errors.
- cert:subject_hash()
-
Subject hash from certificate.
Calculate the hash in hexadecimal notation of the subject of this certificate.
Returns:
-
string
The hexadecimal representation of the hash of the subject.