Skip to content

Instantly share code, notes, and snippets.

@greatkylin
greatkylin / gist:cdcd7fcf07c25f1345742cbc01a25f8d
Created March 10, 2021 07:41 — forked from gambol99/gist:d55afd69217b8e2dd727be99f0a20e7d
golang - create ca and build csr for signing
//
// createCertificateAuthority generates a certificate authority request ready to be signed
//
func (r *secretStore) createCertificateAuthority(names pkix.Name, expiration time.Duration, size int) (*caCertificate, error) {
// step: generate a keypair
keys, err := rsa.GenerateKey(rand.Reader, size)
if err != nil {
return nil, fmt.Errorf("unable to genarate private keys, error: %s", err)
}
@greatkylin
greatkylin / LICENSE
Created March 10, 2021 07:41 — forked from shaneutt/LICENSE
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
MIT License
Copyright (c) 2020 Shane Utt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions: