Versions in this module Expand all Collapse all v1 v1.4.8 Jul 31, 2020 Changes in this version + const CAChainParentFirstEnvVar + const DefaultServerAddr + const DefaultServerPort + func AffiliationDecoder(decoder *json.Decoder) error + func BytesToX509Cert(bytes []byte) (*x509.Certificate, error) + func CopyFile(src, dst string) error + func GenerateECDSATestCert() error + func GetCertID(bytes []byte) (string, string, error) + func GetKeyRequest(cfg *CAConfig) *api.BasicKeyRequest + func IdentityDecoder(decoder *json.Decoder) error + func LoadPEMCertPool(certFiles []string) (*x509.CertPool, error) + func NormalizeURL(addr string) (*url.URL, error) + func UnmarshalConfig(config interface{}, vp *viper.Viper, configFile string, server bool) error + type Accessor struct + func NewDBAccessor(cadb db.FabricCADB) *Accessor + func (d *Accessor) DeleteAffiliation(name string, force, identityRemoval, isRegistrar bool) (*user.DbTxResult, error) + func (d *Accessor) DeleteUser(id string) (user.User, error) + func (d *Accessor) GetAffiliation(name string) (spi.Affiliation, error) + func (d *Accessor) GetAffiliationTree(name string) (*user.DbTxResult, error) + func (d *Accessor) GetAllAffiliations(name string) (*sqlx.Rows, error) + func (d *Accessor) GetFilteredUsers(affiliation, types string) (*sqlx.Rows, error) + func (d *Accessor) GetUser(id string, attrs []string) (user.User, error) + func (d *Accessor) GetUserLessThanLevel(level int) ([]user.User, error) + func (d *Accessor) InsertAffiliation(name string, prekey string, level int) error + func (d *Accessor) InsertUser(user *cadbuser.Info) error + func (d *Accessor) ModifyAffiliation(oldAffiliation, newAffiliation string, force, isRegistrar bool) (*user.DbTxResult, error) + func (d *Accessor) SetDB(db db.FabricCADB) + func (d *Accessor) UpdateUser(user *cadbuser.Info, updatePass bool) error + type CA struct + Config *CAConfig + ConfigFilePath string + HomeDir string + func (ca *CA) CertDBAccessor() *CertDBAccessor + func (ca *CA) DBAccessor() user.Registry + func (ca *CA) GetCertificate(serial, aki string) (*certdb.CertificateRecord, error) + func (ca *CA) GetDB() db.FabricCADB + func (ca *CA) VerifyCertificate(cert *x509.Certificate) error + type CAConfig struct + Affiliations map[string]interface{} + CA CAInfo + CRL CRLConfig + CSP *factory.FactoryOpts + CSR api.CSRInfo + Cfg CfgOptions + Client *ClientConfig + DB CAConfigDB + Idemix idemix.Config + Intermediate IntermediateCA + LDAP ldap.Config + Registry CAConfigRegistry + Signing *config.Signing + Version string + type CAConfigDB struct + Datasource string + TLS tls.ClientTLSConfig + Type string + func (c CAConfigDB) String() string + type CAConfigIdentity struct + Affiliation string + Attrs map[string]string + MaxEnrollments int + Name string + Pass string + Type string + func (cc CAConfigIdentity) String() string + type CAConfigRegistry struct + Identities []CAConfigIdentity + MaxEnrollments int + type CAInfo struct + Certfile string + Chainfile string + Keyfile string + Name string + type CORS struct + Enabled bool + Origins []string + type CRLConfig struct + Expiry time.Duration + type CertDBAccessor struct + func NewCertDBAccessor(db cadb.FabricCADB, level int) *CertDBAccessor + func (d *CertDBAccessor) GetCertificate(serial, aki string) (crs []certdb.CertificateRecord, err error) + func (d *CertDBAccessor) GetCertificateWithID(serial, aki string) (crs db.CertRecord, err error) + func (d *CertDBAccessor) GetCertificates(req cr.CertificateRequest, callersAffiliation string) (*sqlx.Rows, error) + func (d *CertDBAccessor) GetCertificatesByID(id string) (crs []db.CertRecord, err error) + func (d *CertDBAccessor) GetOCSP(serial, aki string) (ors []certdb.OCSPRecord, err error) + func (d *CertDBAccessor) GetRevokedAndUnexpiredCertificates() ([]certdb.CertificateRecord, error) + func (d *CertDBAccessor) GetRevokedAndUnexpiredCertificatesByLabel(label string) ([]certdb.CertificateRecord, error) + func (d *CertDBAccessor) GetRevokedCertificates(expiredAfter, expiredBefore, revokedAfter, revokedBefore time.Time) ([]certdb.CertificateRecord, error) + func (d *CertDBAccessor) GetUnexpiredCertificates() (crs []certdb.CertificateRecord, err error) + func (d *CertDBAccessor) GetUnexpiredOCSPs() (ors []certdb.OCSPRecord, err error) + func (d *CertDBAccessor) InsertCertificate(cr certdb.CertificateRecord) error + func (d *CertDBAccessor) InsertOCSP(rr certdb.OCSPRecord) error + func (d *CertDBAccessor) RevokeCertificate(serial, aki string, reasonCode int) error + func (d *CertDBAccessor) RevokeCertificatesByID(id string, reasonCode int) (crs []db.CertRecord, err error) + func (d *CertDBAccessor) SetDB(db *db.DB) + func (d *CertDBAccessor) UpdateOCSP(serial, aki, body string, expiry time.Time) error + func (d *CertDBAccessor) UpsertOCSP(serial, aki, body string, expiry time.Time) error + type CertificateDecoder struct + func NewCertificateDecoder(storePath string) *CertificateDecoder + func (cd *CertificateDecoder) CertificateDecoder(decoder *json.Decoder) error + func (cd *CertificateDecoder) StoreCert(enrollmentID, storePath string, cert []byte) error + type CertificateStatus string + const Good + const Revoked + type CfgOptions struct + Affiliations affiliationsOptions + Identities identitiesOptions + type Client struct + Config *ClientConfig + HomeDir string + func TestGetClient(port int, home string) *Client + func TestGetRootClient() *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) (*GetCAInfoResponse, error) + func (c *Client) GetCSP() bccsp.BCCSP + func (c *Client) GetCertFilePath() string + func (c *Client) GetIssuerPubKey() (*idemix.IssuerPublicKey, error) + func (c *Client) Init() error + func (c *Client) LoadCSRInfo(path string) (*api.CSRInfo, error) + func (c *Client) LoadIdentity(keyFile, certFile, idemixCredFile string) (*Identity, error) + func (c *Client) LoadMyIdentity() (*Identity, error) + func (c *Client) NewIdentity(creds []credential.Credential) (*Identity, error) + func (c *Client) NewX509Identity(name string, creds []credential.Credential) x509cred.Identity + func (c *Client) SendReq(req *http.Request, result interface{}) (err error) + func (c *Client) StreamResponse(req *http.Request, stream string, cb func(*json.Decoder) error) (err error) + type ClientConfig struct + CAInfo api.GetCAInfoRequest + CAName string + CSP *factory.FactoryOpts + CSR api.CSRInfo + Debug bool + Enrollment api.EnrollmentRequest + ID api.RegistrationRequest + LogLevel string + MSPDir string + Revoke api.RevocationRequest + TLS tls.ClientTLSConfig + URL string + func (c *ClientConfig) Enroll(rawurl, home string) (*EnrollmentResponse, error) + func (c *ClientConfig) GenCSR(home string) error + type DN struct + type EnrollmentResponse struct + CAInfo GetCAInfoResponse + Identity *Identity + type GetCAInfoResponse struct + CAChain []byte + CAName string + IssuerPublicKey []byte + IssuerRevocationPublicKey []byte + Version string + type Identity struct + func NewIdentity(client *Client, name string, creds []credential.Credential) *Identity + func (i *Identity) AddAffiliation(req *api.AddAffiliationRequest) (*api.AffiliationResponse, error) + func (i *Identity) AddIdentity(req *api.AddIdentityRequest) (*api.IdentityResponse, error) + func (i *Identity) Delete(endpoint string, result interface{}, queryParam map[string]string) error + func (i *Identity) GenCRL(req *api.GenCRLRequest) (*api.GenCRLResponse, error) + func (i *Identity) Get(endpoint, caname string, result interface{}) error + func (i *Identity) GetAffiliation(affiliation, caname string) (*api.AffiliationResponse, error) + func (i *Identity) GetAllAffiliations(caname string) (*api.AffiliationResponse, error) + func (i *Identity) GetAllIdentities(caname string, cb func(*json.Decoder) error) error + func (i *Identity) GetCRI(req *api.GetCRIRequest) (*api.GetCRIResponse, error) + func (i *Identity) GetCertificates(req *api.GetCertificatesRequest, cb func(*json.Decoder) error) error + func (i *Identity) GetClient() *Client + func (i *Identity) GetECert() *x509.Signer + func (i *Identity) GetIdemixCredential() credential.Credential + func (i *Identity) GetIdentity(id, caname string) (*api.GetIDResponse, error) + func (i *Identity) GetName() string + func (i *Identity) GetStreamResponse(endpoint string, queryParam map[string]string, stream string, ...) error + func (i *Identity) GetTCertBatch(req *api.GetTCertBatchRequest) ([]*x509.Signer, error) + func (i *Identity) GetX509Credential() credential.Credential + func (i *Identity) ModifyAffiliation(req *api.ModifyAffiliationRequest) (*api.AffiliationResponse, error) + func (i *Identity) ModifyIdentity(req *api.ModifyIdentityRequest) (*api.IdentityResponse, error) + func (i *Identity) Post(endpoint string, reqBody []byte, result interface{}, ...) error + func (i *Identity) Put(endpoint string, reqBody []byte, queryParam map[string]string, ...) 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) RemoveAffiliation(req *api.RemoveAffiliationRequest) (*api.AffiliationResponse, error) + func (i *Identity) RemoveIdentity(req *api.RemoveIdentityRequest) (*api.IdentityResponse, error) + func (i *Identity) Revoke(req *api.RevocationRequest) (*api.RevocationResponse, error) + func (i *Identity) RevokeSelf() (*api.RevocationResponse, error) + func (i *Identity) Store() error + type IntermediateCA struct + Enrollment api.EnrollmentRequest + ParentServer ParentServer + TLS tls.ClientTLSConfig + type ParentServer struct + CAName string + URL string + func (parent ParentServer) String() string + type Server struct + BlockingStart bool + Config *ServerConfig + HomeDir string + Metrics servermetrics.Metrics + Operations operationsServer + func TestGetIntermediateServer(idx int, t *testing.T) *Server + func TestGetRootServer(t *testing.T) *Server + func TestGetServer(port int, home, parentURL string, maxEnroll int, t *testing.T) *Server + func TestGetServer2(deleteHome bool, port int, home, parentURL string, maxEnroll int, t *testing.T) *Server + func (s *Server) GetCA(name string) (*CA, error) + func (s *Server) HealthCheck(ctx context.Context) error + func (s *Server) Init(renew bool) (err error) + func (s *Server) Log(keyvals ...interface{}) error + func (s *Server) RegisterBootstrapUser(user, pass, affiliation string) error + func (s *Server) Start() (err error) + func (s *Server) Stop() error + type ServerConfig struct + Address string + CAcfg CAConfig + CAcount int + CAfiles []string + CORS CORS + CRLSizeLimit int + Client *ClientConfig + CompMode1_3 bool + Debug bool + LogLevel string + Metrics operations.MetricsOptions + Operations operations.Options + Port int + TLS tls.ServerTLSConfig + type ServerInfoResponseNet struct + CAChain string + CAName string + IssuerPublicKey string + Version string + type ServerRequestContext interface + BasicAuthentication func() (string, error) + CanActOnType func(string) error + ChunksToDeliver func(string) (int, error) + ContainsAffiliation func(string) error + GetBoolQueryParm func(name string) (bool, error) + GetCaller func() (user.User, error) + GetCertificates func(cr.CertificateRequest, string) (*sqlx.Rows, error) + GetQueryParm func(name string) string + GetReq func() *http.Request + GetResp func() http.ResponseWriter + HasRole func(role string) error + IsLDAPEnabled func() bool + ReadBody func(interface{}) error + TokenAuthentication func() (string, error)