acme.openssl_helpers

Small helpers for openssl

This module contains all the OpenSSL related helpers to wrap functionality of the D language binding provided by the dub module 'openssl'.

See: https://github.com/D-Programming-Deimos/openssl

Note: The D binding seem to be outdated or otherwise broken. At least some code only works in C. That's why a C stub was added. However, the code is still available in D below in hope that things can be fixed later.

Members

Aliases

tupleCsrPkey
alias tupleCsrPkey = Tuple!(string, "csr", string, "pkey")

Return tuple of makeCertificateSigningRequest

Functions

SSL_CloseLibrary
void SSL_CloseLibrary()

Teardown SSL library

SSL_OpenLibrary
bool SSL_OpenLibrary()

Initialize SSL library

SSL_x509_get_DER_as_B64URL
char[] SSL_x509_get_DER_as_B64URL(X509_REQ* x509_req)

Get a CSR as base64url-encoded DER string

SSL_x509_get_PEM
char[] SSL_x509_get_PEM(X509_REQ* x509_req)

Get a CSR as PEM string

SSL_x509_make_cert
X509* SSL_x509_make_cert(EVP_PKEY* pkey, char[] dev_serial)

Make a x509 cert

SSL_x509_make_csr
X509_REQ* SSL_x509_make_csr(EVP_PKEY* pkey, string[] domainNames)

Make a x509 CSR (cert signing request) @param pkey pointer to pkey struct to store @param dev_serial pointer to device serial string

SSL_x509_make_pkey
EVP_PKEY* SSL_x509_make_pkey(int bits = 4096)

Make a x509 pkey

SSL_x509_read_pkey
EVP_PKEY* SSL_x509_read_pkey(char[] path)

Read a x509 pkey from a file @param path pathname of file to read

SSL_x509_read_pkey_memory
EVP_PKEY* SSL_x509_read_pkey_memory(const char[] pkeyString, RSA** rsaRef = null)

Read a x509 pkey pem string from memory

SSL_x509_write_cert
int SSL_x509_write_cert(char[] path, X509* x509)

Save a x509 cert to a file @param path pathname of file to write @param x509 pointer to x509 struct to store

SSL_x509_write_pkey
int SSL_x509_write_pkey(char[] path, EVP_PKEY* pkey)

Save a x509 pkey to a file @param path pathname of file to write @param pkey pointer to pkey struct to store

base64Encode
char[] base64Encode(T t)

Encode data as Base64

base64EncodeUrlSafe
char[] base64EncodeUrlSafe(T t)

Encode data as URl-safe Base64

base64EncodeUrlSafe
char[] base64EncodeUrlSafe(const BIGNUM* bn)

Encode BIGNUM data as URl-safe Base64

convertDERtoPEM
string convertDERtoPEM(const char[] der)

Convert certificate from DER format to PEM format

extractExpiryData
T extractExpiryData(const(char[]) cert)

Extract expiry date from a PEM encoded Zertificate

getBigNumber
string getBigNumber(BIGNUM* bn)

Get the contents of a big number as string

getBigNumberBytes
ubyte[] getBigNumberBytes(const BIGNUM* bn)

Get the content bytes of a big number as string

makeCertificateSigningRequest
tupleCsrPkey makeCertificateSigningRequest(string[] domainNames)

Create a CSR with our domains

openSSL_CreateCertificateSignRequest
char[] openSSL_CreateCertificateSignRequest(const char[] prkey, string[] domainNames)

Create a SSL cert signing request from a pkey and a serial number

openSSL_CreatePrivateKey
char[] openSSL_CreatePrivateKey(int bits = 4096)

Create a SSL private key

sha256Encode
ubyte[SHA256_DIGEST_LENGTH] sha256Encode(const char[] s)

Calculate the SHA256 of a string

signDataWithSHA256
char[] signDataWithSHA256(char[] s, EVP_PKEY* privateKey)

Sign a given string with an SHA256 hash

toString
string toString(BIO* bio)

Export BIO contents as an array of immutable chars (string)

toVector
char[] toVector(BIO* bio)

Export BIO contents as an array of chars

Meta