Skip to content

QSslUtils is a collection high level functions for creating RSA keys, CA certificates, certificate signing requests and signing CSRs.

License

Notifications You must be signed in to change notification settings

jbagg/QtSslUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QSslUtils is a collection high level functions for creating RSA keys, CA certificates, certificate signing requests and signing CSRs.

Building

QSslUtils can be built directly into your project if your project is LGPL3 compatible. If your project is closed source, you can build QSslUtils as a dynamic library and link against it.

Building into your project

  1. Clone as a git submodule or download QSslUtils. If you download, unzip as a directory to be under your project's directory.

  2. Include the qtsslutils.pri file in your projects .pro file

    include(QtSslUtils/qtsslutils.pri)

    INCLUDEPATH=+ QSslUtils

  3. Add QZEROCONF_STATIC define in your projects .pro file

    DEFINES= QSSLUTILS_STATIC

Compiling as a dynamic library

  1. Clone or download QSslUtils. If you download, unzip.
  2. Enter the QtSslUtils directory, run qmake, then make, then (sudo) make install

API

Creating a CA

  1. Include header
#include "qsslutils.h"
  1. Create an super secret key and then pass that key to the createCA function. The last two parameters to createCA are serial number and days the cert should be valid for.
QSslEvpKey superSecretKey = QSslUtils::generateRSAKey(2048);
QSslX509 ca = QSslUtils::createCA(superSecretKey, "US", "MD", "Fort Meade", "FooBar NSA", "IT", 1, 30);

QSslEvpKey and QSslX509 are smart pointers with custom deleters so they will call the correct ssl free function when their reference count goes to 0.

Create a local certificate

  1. Include header
#include "qsslutils.h"
  1. Create a RSA key to be used for the intermediate or local certificate.

  2. Create a Certificate Signing Request.

  3. Then use the created CA from above "Creating a CA" and it's super secret key to sign the CSR. The last two parameters to signCSR are serial number and days the cert should be valid for.

QSslEvpKey reqKey = QSslUtils::generateRSAKey(2048);
QSslX509Req req = QSslUtils::createCSR(reqKey, "CA", "Ontario", "Ottawa", "FooBar CSIS", "IT");
QSslX509 cert = QSslUtils::signCSR(ca, superSecretKey, req, 1, 30);

QSslEvpKey, QSslX509Req and QSslX509 are smart pointers with custom deleters so they will call the correct ssl free function when their reference count goes to 0.

About

QSslUtils is a collection high level functions for creating RSA keys, CA certificates, certificate signing requests and signing CSRs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published