A Gem to generate custom X509 certificates in specs.
Add the following line to your application's Gemfile.
gem 'mini_ca'
And then run bundle install
.
# Instantiate a CA
ca = MiniCa::Certificate.new('My Test CA', ca: true)
# Create an intermediate
intermediate = ca.issue('My Intermediate', ca: true)
# Create a certificate
certificate = intermediate.issue('My Certificate')
# Get the certificate chain as PEM
certificate.chain_pem
# Get the certificate bundle (i.e. including the leaf certificate) as PEM
certificate.bundle_pem
# Verify a certificate
ca.store.verify(certificate.x509, [intermediate.x509])
See the specs for more examples.
- Fork the project.
- Commit your changes, with specs.
- Ensure that your code passes specs (
rake spec
) and meets Aptible's Ruby style guide (rake rubocop
). - Create a new pull request on GitHub.
MIT License, see LICENSE for details.
Copyright (c) 2019 Aptible, Thomas Orozco, and contributors.