Documentation
¶
Overview ¶
Package openssl implements basic functionality of OpenSSL - Key generation - X509 Request generation - X509 Request signing
Index ¶
- Constants
- Variables
- func NewRSAKey(bits int) ([]byte, error)
- func PreCheck() error
- func ReadKey(in io.Reader, pass string) ([]byte, error)
- func ReadKeyFile(path string, pass string) ([]byte, error)
- func WriteKey(out io.Writer, key []byte, pass string) error
- func WriteKeyFile(path string, key []byte, pass string) error
- type CA
- func (ca *CA) CRL() (pem []byte, err error)
- func (ca CA) Cert(subj string) (crt *x509.Certificate, err error)
- func (ca *CA) List() (certs []*x509.Certificate, err error)
- func (ca *CA) ListAsync(certs chan<- *x509.Certificate, errch chan<- error)
- func (ca *CA) NewCert(subj string, v3ext string, days int, key []byte) (*x509.Certificate, error)
- func (*CA) NewRSAKey(bits int) ([]byte, error)
- func (ca *CA) Revoke(subj string) (*x509.Certificate, error)
- type Config
Constants ¶
const RSABITS = 4096
SetDebug sets the Debug variable and manipulates RSABITS is the default RSA key length
Variables ¶
var Debug bool
var ErrNoCert = ca.ErrNoCert
var Info = "openssl"
Functions ¶
func NewRSAKey ¶
NewRSAKey generates a new RSA key with the number of bits. You may use RSABITS to get the package key length. The result is in PEM format.
func ReadKey ¶
ReadKey reads the encrypted PEM file back and stores the decrypted key in memory (PEM)
func ReadKeyFile ¶
ReadKeyFile reads the encrypted key from a file and stores the encrypted variant (PEM) in memory
Types ¶
type CA ¶
type CA struct { *Config // contains filtered or unexported fields }
func Init ¶
Initialize a new CA with subj and a passphrase for the Ca's private key. If no passphrase is supplied, it will be prompted via /dev/tty
func NewCA ¶
NewC returns a CA that is ready to sign requests. Basically this CA is even ready to create requests based on the config, which actually isn't the job of a CA. Loading (and decrypting) the key is delayed until we really need it (e.g. for creating requests it is not necessary)
func (CA) Cert ¶
func (ca CA) Cert(subj string) (crt *x509.Certificate, err error)
Cert retrieves a cert from the CA
func (*CA) NewCert ¶
NewCert creates a new signed certificate from the given subject and key, in other words, we take the key, create the suitable request (with the configuration of the CA), and finally sign this.
func (*CA) Revoke ¶
func (ca *CA) Revoke(subj string) (*x509.Certificate, error)
Revoke revokes the certificate with the given subject. After updating the index, the old certificate file will be removed FIXME: it shouldn't revoke only one, but all certs with this subject TODO: it should update the CRL