Skip to main content

Create certificate request

Project description

Python module to generate key, certificate request and self signed certificate

Information

This can be used only with python2.7

Getting started

required modules:

  • Click

  • pycparser

  • PyYAML

Installing package using pip

$ pip install --user CertGenerator

Add symbolic link

$ sudo ln -s /Users/{user}/Library/Python/2.7/bin/cert /usr/bin/cert

or

$ cd /usr/bin
$ sudo ln -s /Users/{user}/Library/Python/2.7/bin/cert

Usage

Usage: cli.py [OPTIONS] COMMAND [ARGS]...

  A command line tool to create and read CSR and P12

Options:
  -v, --verbose  Display only if necessary
  -d, --debug    Display all details
  --version      show version and exit
  -h, --help     Show this message and exit.

Commands:
  config               Edit or read config ini
  create               Create a single CSR
  create-multiple      Create multiple certificate using csv file
  create-multiple-p12  Create multiple p12 using csv file
  create-p12           Create a simple p12 Need key file and pem file
  init                 Create certificate folder and default csv file
  read                 Read csr or p12

On terminal you can use:

$ cert [ARGS]

The folder folder will be created in /Users/{user}/Documents/CertGenerator

.CertGenerator
├── certificate
│   ├── csr
│   └── p12
├── csr.yaml
├── csv
│   └── serial.csv
└── log
    └── certgen.log

You can change default app folder using init arg:

$ cert init -cert {path}

the new folder will be structured the same way

Optional configurations file

config.ini

2 sections in config.ini

  • default
    • log_file is the log of file, where are referenced errors and warnings

  • config
    • csvFile is csv file to create several csr

    • yamlFile is the yaml file to configure the datas of the csr

a third section custom can be added to change default app folder see config.

In config.ini:

[default]
log_file = certgen.log

[config]
csvfile = serial.csv
yamlfile = csr.yaml

Config add custom path to config ini

Read config ini

$ cert config read

Change default path of app and default csv file path or csv name, it will add a custom section

$ cert config edit [-cert [path/to/app folder]] [-csv [path/to/csv or csv file]]

Delete custom path of app or csv file, if no flag, it will delete the entire custom section

$ cert config delete [[-cert] [-csv]]

yaml

CertGenerator
|── csr.yaml

In csr.yaml:

C: 'FR'
O: 'FTW Enterprise'
OU: 'IT'
CN: 'Test'
emailAddress: 'csr@test.com'

csv

CertGenerator
├── csv
│   └── serial.csv
  • You must add header column ‘serial’

  • you can create multiple csr using csv file in csv folder

  • The row from csv will be added in CN.

serial.csv

serial

SN123456

SNjhgjkhkjh

SDjhijoklklk

SN654

Create Certificate

Create one certificate

$ cert create [FQDN]

using config.ini:

$ cert create -c [FQDN]

Create multiple certificate

using csv file:

$ cert create-multiple [-a] [--csv=[path/csv]]

‘-a’ is only if you use absolute path of –csv, if you don’t use absolute path, it will search in csv folder

using config.ini:

$ cert -c create-multiple [-a] [--csv=[path/csv]]

Please note, –csv override csv from config.ini

Read certificate

$ cert read [path/of/csr]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

CertGenerator-2.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

CertGenerator-2.0.0-py2-none-any.whl (18.2 kB view details)

Uploaded Python 2

File details

Details for the file CertGenerator-2.0.0.tar.gz.

File metadata

  • Download URL: CertGenerator-2.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for CertGenerator-2.0.0.tar.gz
Algorithm Hash digest
SHA256 aec695c51fc6257c0e181fa814cc8901fec496d6b3c4d08dc5c417e64262eee3
MD5 4e6548e189a84e496d7f48bd7607bb49
BLAKE2b-256 342814cbf744a4ff59b7df17815d1ef232b8126f910f33fc0977ed478ae9601c

See more details on using hashes here.

File details

Details for the file CertGenerator-2.0.0-py2-none-any.whl.

File metadata

  • Download URL: CertGenerator-2.0.0-py2-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.10

File hashes

Hashes for CertGenerator-2.0.0-py2-none-any.whl
Algorithm Hash digest
SHA256 8e82f357d4614183637cf015dea33fc1b0b00661ab4d935334247b6f67d9cf0d
MD5 76ab750509ca963641a1141233d53b75
BLAKE2b-256 c747d306a420997ecc02f06b69152213873b09ce4e2c9fa828edfefb50e1fc11

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page