v1.0.0-alpha3 Latest Latest

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 24 Imported by: 0




This section is empty.


This section is empty.


func BytesToX509Cert

func BytesToX509Cert(bytes []byte) (*x509.Certificate, error)

BytesToX509Cert converts bytes (PEM or DER) to an X509 certificate

func GetCertID

func GetCertID(bytes []byte) (string, string, error)

GetCertID returns both the serial number and AKI (Authority Key ID) for the certificate

func NormalizeURL

func NormalizeURL(addr string) (*url.URL, error)

NormalizeURL normalizes a URL (from cfssl)


type CAConfig

type CAConfig struct {

CAConfig ...

type CertificateStatus

type CertificateStatus string

CertificateStatus represents status of an enrollment certificate

const (
	// Revoked is the status of a revoked certificate
	Revoked CertificateStatus = "revoked"
	// Good is the status of a active certificate
	Good = "good"

type Client

type Client struct {
	// The client's home directory
	HomeDir string `json:"homeDir,omitempty"`
	// The client's configuration
	Config *ClientConfig
	// contains filtered or unexported fields

Client is the fabric-ca client object

func (*Client) Enroll

func (c *Client) Enroll(req *api.EnrollmentRequest) (*EnrollmentResponse, error)

Enroll enrolls a new identity @param req The enrollment request

func (*Client) GenCSR

func (c *Client) GenCSR(req *api.CSRInfo, id string) ([]byte, core.Key, error)

GenCSR generates a CSR (Certificate Signing Request)

func (*Client) Init

func (c *Client) Init() error

Init initializes the client

func (*Client) NewIdentity

func (c *Client) NewIdentity(key core.Key, cert []byte) (*Identity, error)

NewIdentity creates a new identity

func (*Client) SendReq

func (c *Client) SendReq(req *http.Request, result interface{}) (err error)

SendReq sends a request to the fabric-ca-server and fills in the result

type ClientConfig

type ClientConfig struct {
	URL        string `def:"http://localhost:7054" opt:"u" help:"URL of fabric-ca-server"`
	MSPDir     string `def:"msp" opt:"M" help:"Membership Service Provider directory"`
	TLS        tls.ClientTLSConfig
	Enrollment api.EnrollmentRequest
	CSR        api.CSRInfo
	ID         api.RegistrationRequest
	Revoke     api.RevocationRequest
	CAInfo     api.GetCAInfoRequest
	CAName     string           `help:"Name of CA"`
	CSP        core.CryptoSuite `mapstructure:"bccsp"`

ClientConfig is the fabric-ca client's config

type EnrollmentResponse

type EnrollmentResponse struct {
	Identity   *Identity
	ServerInfo GetServerInfoResponse

EnrollmentResponse is the response from Client.Enroll and Identity.Reenroll

type GetServerInfoResponse

type GetServerInfoResponse struct {
	// CAName is the name of the CA
	CAName string
	// CAChain is the PEM-encoded bytes of the fabric-ca-server's CA chain.
	// The 1st element of the chain is the root CA cert
	CAChain []byte
	// Version of the server
	Version string

GetServerInfoResponse is the response from the GetServerInfo call

type Identity

type Identity struct {
	CSP core.CryptoSuite
	// contains filtered or unexported fields

Identity is fabric-ca's implementation of an identity

func (*Identity) GetECert

func (i *Identity) GetECert() *Signer

GetECert returns the enrollment certificate signer for this identity

func (*Identity) GetName

func (i *Identity) GetName() string

GetName returns the identity name

func (*Identity) Post

func (i *Identity) Post(endpoint string, reqBody []byte, result interface{}, queryParam map[string]string) error

Post sends arbitrary request body (reqBody) to an endpoint. This adds an authorization header which contains the signature of this identity over the body and non-signature part of the authorization header. The return value is the body of the response.

func (*Identity) Reenroll

Reenroll reenrolls an existing Identity and returns a new Identity @param req The reenrollment request

func (*Identity) Register

func (i *Identity) Register(req *api.RegistrationRequest) (rr *api.RegistrationResponse, err error)

Register registers a new identity @param req The registration request

func (*Identity) Revoke

Revoke the identity associated with 'id'

type ServerConfig

type ServerConfig struct {
	CAcfg CAConfig `skip:"true"`

ServerConfig ...

type Signer

type Signer struct {
	// contains filtered or unexported fields

Signer represents a signer Each identity may have multiple signers, currently one ecert and multiple tcerts

func (*Signer) Cert

func (s *Signer) Cert() []byte

Cert returns the cert bytes of this signer

func (*Signer) Key

func (s *Signer) Key() core.Key

Key returns the key bytes of this signer


Path Synopsis

Jump to

Keyboard shortcuts

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