certifier

module
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2025 License: MPL-2.0

README ΒΆ

Certifier - X.509 Certificate Management Library and CLI

Go Version License Go Report Card codecov CI Release GoDoc

A performant and optimized Go library for generating, validating, and managing X.509 certificates, Certificate Authorities (CAs), and related cryptographic operations.


✨ Features

πŸ” Core Library Features
  • Certificate Generation

    • Self-signed certificates
    • CA certificates with path length constraints
    • Server/Client certificates
    • Certificate Signing Requests (CSR)
    • RSA-PSS support for enhanced security
  • πŸ”‘ Key Management

    • RSA (2048, 4096 bits)
    • ECDSA (P-256, P-384, P-521)
    • Ed25519
    • Secure key generation using crypto/rand
  • πŸ“ Encoding/Decoding

    • PEM format support
    • DER format support
    • PKCS#12 (P12/PFX) bundle support
  • βœ… Validation

    • Chain of trust verification
    • Expiration checking
    • Hostname verification
    • Signature algorithm validation
    • Custom validation rules
  • πŸ”„ Advanced Features

    • Certificate Revocation List (CRL) generation and management
    • OCSP (Online Certificate Status Protocol) support
    • CRL validation and revocation checking
    • Extension support (Key Usage, Extended Key Usage, SAN, etc.)
πŸ’» CLI Tool

The executable supports all library operations:

  • Generate CA certificates
  • Generate server/client certificates
  • Sign certificates with CA
  • Validate certificates and chains
  • View certificate details
  • CRL and OCSP operations
  • Batch operations via config files
πŸš€ Deployment
  • Multi-platform Support: Windows, Linux, macOS (AMD64, ARM64)
  • GitHub Actions: Automated linting, testing, security scanning (SonarQube), and releases
  • Package Distribution: Published to Go pkg registry on releases
  • Docker Support: Container-ready

πŸ“¦ Installation

.
β”œβ”€β”€ cmd/certifier/              # Executable
β”œβ”€β”€ pkg/
β”‚   β”œβ”€β”€ cert/                   # Core certificate operations
β”‚   β”œβ”€β”€ encoding/               # PEM/DER/PKCS12 encoding
β”‚   β”œβ”€β”€ validation/             # Certificate validation
β”‚   β”œβ”€β”€ crl/                    # CRL management
β”‚   └── ocsp/                   # OCSP support
β”œβ”€β”€ internal/
β”‚   └── cli/                    # CLI command implementations
β”œβ”€β”€ test/                       # Integration tests
β”œβ”€β”€ .github/workflows/          # GitHub Actions
└── go.mod

Installation

From Source
go install github.com/0x524a/certifier/cmd/certifier@latest
From Releases

Download pre-built binaries from GitHub Releases

As a Library
go get github.com/0x524a/certifier

πŸš€ Quick Start

Library Usage
package main

import (
	"log"
	"github.com/0x524a/certifier/pkg/cert"
)

func main() {
	// Generate a self-signed certificate with RSA-PSS for enhanced security
	config := &cert.CertificateConfig{
		CommonName:   "example.com",
		Organization: "Example Corp",
		Country:      "US",
		Validity:     365,
		KeyType:      cert.KeyTypeRSA2048,
		UseRSAPSS:    true, // Enable RSA-PSS for better security
		DNSNames:     []string{"example.com", "www.example.com"},
	}

	cert, key, err := cert.GenerateSelfSignedCertificate(config)
	if err != nil {
		log.Fatal(err)
	}

	// Encode to PEM
	certPEM, _ := encoding.EncodeCertificateToPEM(cert)
	keyPEM, _ := encoding.EncodePrivateKeyToPEM(key)
	
	// Use cert and key...
}
CLI Usage
# Generate a CA certificate
certifier ca generate --cn "My CA" --output ca.crt --key-output ca.key

# Generate a server certificate signed by CA
certifier cert generate \
  --cn "example.com" \
  --ca-cert ca.crt \
  --ca-key ca.key \
  --output server.crt \
  --key-output server.key

# Validate a certificate
certifier cert validate --cert server.crt --ca-cert ca.crt

# View certificate details
certifier cert view --cert server.crt

πŸ“š Documentation


πŸ—οΈ Project Structure

Building
go build -o bin/certifier ./cmd/certifier
Testing
go test -v -cover ./...
Linting
golangci-lint run

⚑ Performance

This library is optimized for:

  • Fast certificate generation using efficient key generation algorithms
  • Minimal memory allocations
  • Concurrent certificate operations where applicable
  • Cache-friendly data structures

Benchmarks:

  • Certificate generation: < 100ms (RSA 2048-bit)
  • Certificate validation: < 10ms
  • CRL generation: < 50ms (1000 revoked certificates)

🀝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

Quick Guidelines
  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Before submitting:

  • βœ… All tests pass (go test ./...)
  • βœ… Code passes linting (golangci-lint run)
  • βœ… Code is formatted (gofmt -w .)
  • βœ… Documentation is updated

πŸ”’ Security

Security is a top priority. See our Security Policy for:

  • Reporting vulnerabilities
  • Supported versions
  • Security best practices

Key Security Features:

  • πŸ” RSA-PSS support for enhanced signature security
  • 🎲 Cryptographically secure random number generation
  • πŸ” Certificate chain validation
  • πŸ“‹ CRL and OCSP support
  • πŸ›‘οΈ No external crypto dependencies
  • πŸ“Œ Pinned GitHub Actions (supply chain security)

πŸ“Š Project Stats

  • Test Coverage: >85%
  • Test Functions: 226+
  • Supported Platforms: Linux, macOS, Windows (AMD64, ARM64)
  • Go Version: 1.22+
  • CI/CD: GitHub Actions with SonarQube integration

πŸ“„ License

See LICENSE file for details.


πŸ’¬ Support


🌟 Star History

If you find this project useful, please consider giving it a star! ⭐


πŸ“ Changelog

See Releases for detailed changelog.


Made with ❀️ by the Certifier community

Directories ΒΆ

Path Synopsis
cmd
certifier command
internal
cli
pkg
crl

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL