Giter Club home page Giter Club logo

mkcert's Introduction

mkcert: A simple program to create X.509 certificates

Getting started

  1. Download and unpack the latest binary release for your platform:

  2. Open a terminal and run the program.

$ ./mkcert --help      # Linux
$ .\mkcert.exe --help  # Windows

Features

Creating new certificates

It is not necessary to copy and move around private keys. Create them directly on the target host.

  1. Copy the program to the host where you need the new certificate.

  2. Create a template file: Click here for some examples.

  3. Choose a strong (long and random) passphrase.

$ mkcert -f examples/request.yaml
New certificate: csr.example.com
Enter new passphrase:
Verifying - Enter new passphrase:

$ ls csr*
csr.example.com.csr  csr.example.com.key

Private keys

Each new certificate gets a new private key. The private key is encrypted based on the passphrase you specify. You can use/decrypt the key with the same passphrase.

Details:

  • Encryption algorithm: AES 256-bit CBC

  • Key derivation function: PBKDF2

Creating PKCS #12 files

A PKCS #12 (.p12) file is a container which bundles a private key and one or more certificates into a single file.

To create a .p12 file:

  1. Put the certificate and the private key together in the same directory.

  2. The file name of the certificate must match the name of the key.

  3. Use the -b, --bundle option followed by the path to the key file.

$ ls
crt.example.com.crt
crt.example.com.key

$ mkcert -b crt.example.com.key  # <- path to key file
Bundle: crt.example.com
Enter passphrase:

$ ls
crt.example.com.crt
crt.example.com.key
crt.example.com.p12

Importing PKCS #12 files into the Windows certificate store

On Windows, use the certificate store if the application which needs the certificate supports it. The store is more secure and you don’t need the .p12 file.

To import a .p12 file:

  1. Double-click the .p12 file to import the private key and the certificate into the Windows certificate store.

  2. Delete the .p12 file after a successful import.

Changelog

All notable changes will be documented here.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[0.2.2] - 2024-07-18

Added

  • More helpful error messages when something goes wrong.

[0.2.1] - 2023-10-22

Changed

  • Set the common name as default subject alternative name (SAN). Some browsers require a SAN to validate the certificate.

Added

  • Helpful error message when the program crashes.

Fixed

  • Build dependencies for OpenSSL.

[0.2.0] - 2023-10-17

Changed

  • The OpenSSL library is now built-in to make the program more portable.

Added

  • Support for creating PKCS #12 files.

[0.1.0] - 2023-10-14

Initial release.

Contributing

The best way to get started is to build and run a local dev container.

You can use Podman or any other OCI compliant container manager. The dev container has all the required dependencies for working with the project.

$ container/build.sh
$ container/run.sh

From inside the container, you can then run some workflows.

$ cargo fmt && cargo clippy --all-targets  # run code formatter and linter
$ cargo test   # run tests
$ cargo doc    # build the docs
$ cargo run    # run the binary crate
$ cargo clean  # remove build artifacts

License

Copyright © 2024 Andreas Longo

GNU General Public License v3.0 or later

mkcert's People

Contributors

andreaslongo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.