Documentation ¶
Index ¶
- func BytesToX509Cert(bytes []byte) (*x509.Certificate, error)
- func GetCertID(bytes []byte) (string, string, error)
- type Client
- func (c *Client) Enroll(req *api.EnrollmentRequest) (*Identity, error)
- func (c *Client) GenCSR(req *api.CSRInfo, id string) ([]byte, []byte, error)
- func (c *Client) GetMyCertFile() string
- func (c *Client) GetMyEnrollmentDir() string
- func (c *Client) GetMyKeyFile() string
- 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, cert []byte) (*Identity, error)
- func (c *Client) NewPost(endpoint string, reqBody []byte) (*http.Request, error)
- func (c *Client) SendPost(req *http.Request) (interface{}, error)
- func (c *Client) StoreMyIdentity(key, cert []byte) error
- type Identity
- 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) (interface{}, error)
- func (i *Identity) Reenroll(req *api.ReenrollmentRequest) (*Identity, error)
- func (i *Identity) Register(req *api.RegistrationRequest) (*api.RegistrationResponse, error)
- func (i *Identity) Revoke(req *api.RevocationRequest) error
- func (i *Identity) RevokeSelf() error
- func (i *Identity) Store() error
- 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
Types ¶
type Client ¶
type Client struct { // ServerURL is the URL of the server ServerURL string `json:"serverURL,omitempty"` // HomeDir is the home directory HomeDir string `json:"homeDir,omitempty"` }
Client is the COP client object
func (*Client) Enroll ¶
func (c *Client) Enroll(req *api.EnrollmentRequest) (*Identity, error)
Enroll enrolls a new identity @param req The enrollment request
func (*Client) GetMyCertFile ¶
GetMyCertFile returns the path to this identity's certificate file
func (*Client) GetMyEnrollmentDir ¶
GetMyEnrollmentDir returns the path to this identity's enrollment directory
func (*Client) GetMyKeyFile ¶
GetMyKeyFile returns the path to this identity's key file
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 Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
Identity is COP'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) (*Identity, 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) (*api.RegistrationResponse, error)
Register registers a new identity @param req The registration request
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