libscep - A Client Side SCEP Library
====================================
[![Build Status](https://travis-ci.org/Javex/libscep.svg?branch=develop)](https://travis-ci.org/Javex/libscep)

`libscep` implements the 
[SCEP protocol](http://tools.ietf.org/html/draft-nourse-scep-23) as a C library
and additionally provides a command line client that allows to operate the 
program without need to write an implementation of this library.

The client is based on the classic [sscep](https://github.com/certnanny/sscep)
client and follows the same syntax. Internally it just wraps the library.

The library itself is pretty basic. It gets initialized, then one or multiple
operations can be executed and then it gets destroyed again.

*Note*: This is currently in development phase und not yet ready.

Compiling
----------

Dependencies:

    `openssl`, `cmake`, `pkg-config`, `check` (unit test framework for C),
    `uriparser` (liburiparser1, liburiparser-dev on debian),
    `libcurl4-openssl-dev`

    mkdir build
    cmake ..
    make
    make test

Version Bump
-------------

The major and monir version numbers are tracked in:

    CMakeLists.txt
    src/clients/perl/Crypt-LibSCEP/MYMETA.json
    src/clients/perl/Crypt-LibSCEP/MYMETA.yml
    src/clients/perl/Crypt-LibSCEP/lib/Crypt/LibSCEP.pm

To update the version:

    major=0
    minor=09
    version=$major.$minor
    perl -i -p \
        -e "s{(libscep_VERSION_MAJOR) \d+}{\$1 $major};" \
        -e "s{(libscep_VERSION_MINOR) \d+}{\$1 $minor};" \
        CMakeLists.txt
    perl -i -p \
        -e "s{\"version\" : \"[0-9.]+\"}{\"version\" : \"$version\"};" \
        src/clients/perl/Crypt-LibSCEP/MYMETA.json
    perl -i -p \
        -e "s{^version: \'[0-9.]+\'}{version: \'$version\'};" \
        src/clients/perl/Crypt-LibSCEP/MYMETA.yml
    perl -i -p \
        -e "s{(our .VERSION =) \'[0-9.]+\'}{\$1 \'$version\'};" \
        src/clients/perl/Crypt-LibSCEP/lib/Crypt/LibSCEP.pm
    git add \
        CMakeLists.txt \
        src/clients/perl/Crypt-LibSCEP/MYMETA.json \
        src/clients/perl/Crypt-LibSCEP/MYMETA.yml \
        src/clients/perl/Crypt-LibSCEP/lib/Crypt/LibSCEP.pm

    # Commit version bump
    git commit -m "bump to v$version"
    git tag -a v$version -m "bump to v$version"


Building Debian Package
------------------------

The Debian packaging is done via Vagrant. To create the libscep and Perl
library packages, run the following:

    vagrant up debian
    vagrant ssh --command /vagrant/package/make-deb.sh debian

The resulting debian package files will be copied to the current directory.

NOTE: The current support for building packages is proof-of-concept. The
package versions must be set manually in the debian/\* files.

Uploading Perl Module to CPAN
-----------------------------

Bump the version (see the 'Version Bump' section above). Then, run:

    cd src/clients/perl/Crypt-LibSCEP
    version=$(perl -MYAML -e '$y = YAML::LoadFile("MYMETA.yml");print $y->{version};')
    git archive \
        --prefix=Crypt-LibSCEP-$version/ \
        --output Crypt-LibSCEP-$version.tar.gz \
        v$version
    cpan-upload Crypt-LibSCEP-$version.tar.gz


