Version: v0.0.0-...-edc6592 Latest Latest

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

Go to latest
Published: Jul 9, 2014 License: BSD-2-Clause Imports: 10 Imported by: 0



Package csr implements certificate requests for CF-SSL.



This section is empty.


View Source
var DefaultKeyRequest = KeyRequest{
	Algo: "ecdsa",
	Size: curveP256,

The DefaultKeyRequest is used when no key request data is provided in the request. This should be a safe default.


func ParseRequest

func ParseRequest(req *CertificateRequest) (csr, key []byte, err error)

ParseRequest takes a certificate request and generates a key and CSR from it. It does no validation -- caveat emptor. It will, however, fail if the key request is not valid (i.e., an unsupported curve or RSA key size). The lack of validation was specifically chosen to allow the end user to define a policy and validate the request appropriately before calling this function.


type CertificateRequest

type CertificateRequest struct {
	CN         string
	Names      []Name      `json:"names"`
	Hosts      []string    `json:"hosts"`
	KeyRequest *KeyRequest `json:"key,omitempty"`

A CertificateRequest encapsulates the API interface to the certificate request functionality.

func (*CertificateRequest) Name

func (cr *CertificateRequest) Name() pkix.Name

Name returns the PKIX name for the request.

type Generator

type Generator struct {
	Validator func(*CertificateRequest) error

A Generator is responsible for validating certificate requests.

func (*Generator) ProcessRequest

func (g *Generator) ProcessRequest(req *CertificateRequest) (csr, key []byte, err error)

ProcessRequest validates and processes the incoming request. It is a wrapper around a validator and the ParseRequest function.

type KeyRequest

type KeyRequest struct {
	Algo string `json:"algo"`
	Size int    `json:"size"`

A KeyRequest contains the algorithm and key size for a new private key.

func (*KeyRequest) Generate

func (kr *KeyRequest) Generate() (interface{}, error)

Generate generates a key as specified in the request. Currently, only ECDSA and RSA are supported.

func (*KeyRequest) SigAlgo

func (kr *KeyRequest) SigAlgo() x509.SignatureAlgorithm

SigAlgo returns an appropriate X.509 signature algorithm given the key request's type and size.

type Name

type Name struct {
	C  string // Country
	ST string // State
	L  string // Locality
	O  string // OrganisationName
	OU string // OrganisationalUnitName

A Name contains the SubjectInfo fields.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL