Documentation ¶
Index ¶
- func BytesToX509Cert(bytes []byte) (*x509.Certificate, error)
- func GetAttrValue(attrs []api.Attribute, name string) string
- func GetCertID(bytes []byte) (string, string, error)
- func LoadPEMCertPool(certFiles []string) (*x509.CertPool, error)
- func NormalizeURL(addr string) (*url.URL, error)
- func UnmarshalConfig(config interface{}, vp *viper.Viper, configFile string, ...) error
- type CAConfig
- type Client
- func (c *Client) CheckEnrollment() error
- func (c *Client) Enroll(req *api.EnrollmentRequest) (*EnrollmentResponse, error)
- func (c *Client) GenCSR(req *api.CSRInfo, id string) ([]byte, bccsp.Key, error)
- func (c *Client) GetCAInfo(req *api.GetCAInfoRequest) (*GetServerInfoResponse, error)
- func (c *Client) GetCertFilePath() string
- func (c *Client) Init() error
- func (c *Client) LoadCSRInfo(path string) (*api.CSRInfo, error)
- func (c *Client) LoadIdentity(keyFile, certFile string) (*Identity, error)
- func (c *Client) LoadMyIdentity() (*Identity, error)
- func (c *Client) NewIdentity(key bccsp.Key, cert []byte) (*Identity, error)
- func (c *Client) SendReq(req *http.Request, result interface{}) (err error)
- func (c *Client) StoreMyIdentity(cert []byte) error
- type ClientConfig
- type EnrollmentResponse
- type GetServerInfoResponse
- type Identity
- func (i *Identity) GetClient() *Client
- func (i *Identity) GetECert() *Signer
- func (i *Identity) GetName() string
- func (i *Identity) GetTCertBatch(req *api.GetTCertBatchRequest) ([]*Signer, error)
- func (i *Identity) Post(endpoint string, reqBody []byte, result interface{}) error
- func (i *Identity) Reenroll(req *api.ReenrollmentRequest) (*EnrollmentResponse, error)
- func (i *Identity) Register(req *api.RegistrationRequest) (rr *api.RegistrationResponse, err error)
- func (i *Identity) RegisterAndEnroll(req *api.RegistrationRequest) (*Identity, error)
- func (i *Identity) Revoke(req *api.RevocationRequest) error
- func (i *Identity) RevokeSelf() error
- func (i *Identity) Store() error
- type ServerConfig
- type Signer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToX509Cert ¶
func BytesToX509Cert(bytes []byte) (*x509.Certificate, error)
BytesToX509Cert converts bytes (PEM or DER) to an X509 certificate
func GetAttrValue ¶
GetAttrValue searches 'attrs' for the attribute with name 'name' and returns its value, or "" if not found.
func GetCertID ¶
GetCertID returns both the serial number and AKI (Authority Key ID) for the certificate
func LoadPEMCertPool ¶
LoadPEMCertPool loads a pool of PEM certificates from list of files
func NormalizeURL ¶
NormalizeURL normalizes a URL (from cfssl)
Types ¶
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) CheckEnrollment ¶
CheckEnrollment returns an error if this client is not enrolled
func (*Client) Enroll ¶
func (c *Client) Enroll(req *api.EnrollmentRequest) (*EnrollmentResponse, error)
Enroll enrolls a new identity @param req The enrollment request
func (*Client) GetCAInfo ¶
func (c *Client) GetCAInfo(req *api.GetCAInfoRequest) (*GetServerInfoResponse, error)
GetCAInfo returns generic CA information
func (*Client) GetCertFilePath ¶
GetCertFilePath returns the path to the certificate file for this client
func (*Client) LoadCSRInfo ¶
LoadCSRInfo reads CSR (Certificate Signing Request) from a file @parameter path The path to the file contains CSR info in JSON format
func (*Client) LoadIdentity ¶
LoadIdentity loads an identity from disk
func (*Client) LoadMyIdentity ¶
LoadMyIdentity loads the client's identity from disk
func (*Client) NewIdentity ¶
NewIdentity creates a new identity
func (*Client) StoreMyIdentity ¶
StoreMyIdentity stores my identity to disk
type ClientConfig ¶
type ClientConfig struct { Debug bool `def:"false" opt:"d" help:"Enable debug level logging"` 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 *factory.FactoryOpts `mapstructure:"bccsp"` }
ClientConfig is the fabric-ca client's config
func (*ClientConfig) Enroll ¶
func (c *ClientConfig) Enroll(rawurl, home string) (*EnrollmentResponse, error)
Enroll a client given the server's URL and the client's home directory. The URL may be of the form: http://user:pass@host:port where user and pass are the enrollment ID and secret, respectively.
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 }
GetServerInfoResponse is the response from the GetServerInfo call
type Identity ¶
Identity is fabric-ca's implementation of an identity
func (*Identity) GetTCertBatch ¶
func (i *Identity) GetTCertBatch(req *api.GetTCertBatchRequest) ([]*Signer, error)
GetTCertBatch returns a batch of TCerts for this identity
func (*Identity) Post ¶
Post sends arbtrary 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 ¶
func (i *Identity) Reenroll(req *api.ReenrollmentRequest) (*EnrollmentResponse, error)
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) RegisterAndEnroll ¶
func (i *Identity) RegisterAndEnroll(req *api.RegistrationRequest) (*Identity, error)
RegisterAndEnroll registers and enrolls an identity and returns the identity
func (*Identity) Revoke ¶
func (i *Identity) Revoke(req *api.RevocationRequest) error
Revoke the identity associated with 'id'
func (*Identity) RevokeSelf ¶
RevokeSelf revokes the current identity and all certificates
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) RevokeSelf ¶
RevokeSelf revokes only the certificate associated with this signer