fabric-sdk-go: github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/lib Index | Files | Directories

package lib

import "github.com/hyperledger/fabric-sdk-go/internal/github.com/hyperledger/fabric-ca/lib"

Index

Package Files

client.go clientconfig.go identity.go sdkpatch_serverstruct.go serverrevoke.go util.go

func BytesToX509Cert Uses

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

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

func GetCertID Uses

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

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

func NormalizeURL Uses

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

NormalizeURL normalizes a URL (from cfssl)

type CAConfig Uses

type CAConfig struct {
}

CAConfig ...

type CertificateDecoder Uses

type CertificateDecoder struct {
    // contains filtered or unexported fields
}

CertificateDecoder is needed to keep track of state, to see how many certificates have been returned for each enrollment ID.

type CertificateStatus Uses

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 Uses

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 Uses

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

Enroll enrolls a new identity @param req The enrollment request

func (*Client) GenCSR Uses

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

GenCSR generates a CSR (Certificate Signing Request)

func (*Client) GetCAInfo Uses

func (c *Client) GetCAInfo(req *api.GetCAInfoRequest) (*GetCAInfoResponse, error)

GetCAInfo returns generic CA information

func (*Client) GetCSP Uses

func (c *Client) GetCSP() core.CryptoSuite

GetCSP returns BCCSP instance associated with this client

func (*Client) GetFabCAVersion Uses

func (c *Client) GetFabCAVersion() (string, error)

GetFabCAVersion is a utility function to fetch the Fabric CA version for this client TODO remove the function below once Fabric CA v1.3 is not supported by the SDK anymore

func (*Client) Init Uses

func (c *Client) Init() error

Init initializes the client

func (*Client) NewIdentity Uses

func (c *Client) NewIdentity(creds []credential.Credential) (*Identity, error)

NewIdentity creates a new identity

func (*Client) NewX509Identity Uses

func (c *Client) NewX509Identity(name string, creds []credential.Credential) x509cred.Identity

NewX509Identity creates a new identity

func (*Client) SendReq Uses

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

func (*Client) StreamResponse Uses

func (c *Client) StreamResponse(req *http.Request, stream string, cb func(*json.Decoder) error) (err error)

StreamResponse reads the response as it comes back from the server

type ClientConfig Uses

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" hide:"true"`
    ServerName string           `help:"CA server name to be used in case of host name override"`

    Debug    bool   `opt:"d" help:"Enable debug level logging" hide:"true"`
    LogLevel string `help:"Set logging level (info, warning, debug, error, fatal, critical)"`
}

ClientConfig is the fabric-ca client's config

type EnrollmentResponse Uses

type EnrollmentResponse struct {
    Identity *Identity
    CAInfo   GetCAInfoResponse
}

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

type GetCAInfoResponse Uses

type GetCAInfoResponse 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
    // Idemix issuer public key of the CA
    IssuerPublicKey []byte
    // Idemix issuer revocation public key of the CA
    IssuerRevocationPublicKey []byte
    // Version of the server
    Version string
}

GetCAInfoResponse is the response from the GetCAInfo call

type Identity Uses

type Identity struct {
    // contains filtered or unexported fields
}

Identity is fabric-ca's implementation of an identity

func NewIdentity Uses

func NewIdentity(client *Client, name string, creds []credential.Credential) *Identity

NewIdentity is the constructor for identity

func (*Identity) AddAffiliation Uses

func (i *Identity) AddAffiliation(req *api.AddAffiliationRequest) (*api.AffiliationResponse, error)

AddAffiliation adds a new affiliation to the server

func (*Identity) AddIdentity Uses

func (i *Identity) AddIdentity(req *api.AddIdentityRequest) (*api.IdentityResponse, error)

AddIdentity adds a new identity to the server

func (*Identity) Delete Uses

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

Delete sends a delete request to an endpoint

func (*Identity) Get Uses

func (i *Identity) Get(endpoint, caname string, result interface{}) error

Get sends a get request to an endpoint

func (*Identity) GetAffiliation Uses

func (i *Identity) GetAffiliation(affiliation, caname string) (*api.AffiliationResponse, error)

GetAffiliation returns information about the requested affiliation

func (*Identity) GetAllAffiliations Uses

func (i *Identity) GetAllAffiliations(caname string) (*api.AffiliationResponse, error)

GetAllAffiliations returns all affiliations that the caller is authorized to see

func (*Identity) GetAllIdentities Uses

func (i *Identity) GetAllIdentities(caname string, cb func(*json.Decoder) error) error

GetAllIdentities returns all identities that the caller is authorized to see

func (*Identity) GetECert Uses

func (i *Identity) GetECert() *x509.Signer

GetECert returns the enrollment certificate signer for this identity Returns nil if the identity does not have a X509 credential

func (*Identity) GetIdentity Uses

func (i *Identity) GetIdentity(id, caname string) (*api.GetIDResponse, error)

GetIdentity returns information about the requested identity

func (*Identity) GetName Uses

func (i *Identity) GetName() string

GetName returns the identity name

func (*Identity) GetStreamResponse Uses

func (i *Identity) GetStreamResponse(endpoint string, queryParam map[string]string, stream string, cb func(*json.Decoder) error) error

GetStreamResponse sends a request to an endpoint and streams the response

func (*Identity) ModifyAffiliation Uses

func (i *Identity) ModifyAffiliation(req *api.ModifyAffiliationRequest) (*api.AffiliationResponse, error)

ModifyAffiliation renames an existing affiliation on the server

func (*Identity) ModifyIdentity Uses

func (i *Identity) ModifyIdentity(req *api.ModifyIdentityRequest) (*api.IdentityResponse, error)

ModifyIdentity modifies an existing identity on the server

func (*Identity) Post Uses

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) Put Uses

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

Put sends a put request to an endpoint

func (*Identity) Reenroll Uses

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 Uses

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

Register registers a new identity @param req The registration request

func (*Identity) RemoveAffiliation Uses

func (i *Identity) RemoveAffiliation(req *api.RemoveAffiliationRequest) (*api.AffiliationResponse, error)

RemoveAffiliation removes an existing affiliation from the server

func (*Identity) RemoveIdentity Uses

func (i *Identity) RemoveIdentity(req *api.RemoveIdentityRequest) (*api.IdentityResponse, error)

RemoveIdentity removes a new identity from the server

func (*Identity) Revoke Uses

func (i *Identity) Revoke(req *api.RevocationRequest) (*api.RevocationResponse, error)

Revoke the identity associated with 'id'

type ServerConfig Uses

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

ServerConfig ...

Directories

PathSynopsis
attrmgr
client/credential
client/credential/x509
common
streamer
tls

Package lib imports 29 packages (graph) and is imported by 2 packages. Updated 2019-04-15. Refresh now. Tools for package owners.