cert

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// CodeAuthorityCannotBeDeleted rides a CA delete: the CA has received a
	// certificate sign request, so the server keeps it and its records.
	CodeAuthorityCannotBeDeleted = "cert_authority_cannot_be_deleted"
	// CodeInvalidPeriod rides a sign request whose valid_days falls outside
	// 1..max_valid_days of the CA.
	CodeInvalidPeriod = "cert_invalid_period"
)

Server refusal codes, read off a 400 with utils.ParseErrorResponse.

Variables

This section is empty.

Functions

func ApproveCSR

func ApproveCSR(ac *client.AlpaconClient, csrId string) ([]byte, error)

func ApproveRevokeRequest added in v1.2.0

func ApproveRevokeRequest(ac *client.AlpaconClient, requestId string) ([]byte, error)

func CancelRevokeRequest added in v1.2.0

func CancelRevokeRequest(ac *client.AlpaconClient, requestId string) error

func DeleteCA

func DeleteCA(ac *client.AlpaconClient, authorityId string) error

func DeleteCSR

func DeleteCSR(ac *client.AlpaconClient, csrId string) error

func DenyCSR

func DenyCSR(ac *client.AlpaconClient, csrId string) ([]byte, error)

func DenyRevokeRequest added in v1.2.0

func DenyRevokeRequest(ac *client.AlpaconClient, requestId string) ([]byte, error)

func DownloadCRL added in v1.2.0

func DownloadCRL(ac *client.AlpaconClient, authorityId string, filePath string) error

func DownloadCertificate

func DownloadCertificate(ac *client.AlpaconClient, certId string, filePath string) error

func DownloadCertificateByCSR added in v1.0.0

func DownloadCertificateByCSR(ac *client.AlpaconClient, csrId string, filePath string) error

func DownloadRootCertificate

func DownloadRootCertificate(ac *client.AlpaconClient, authorityId string, filePath string) error

func GetAuthorityDetail

func GetAuthorityDetail(ac *client.AlpaconClient, authorityId string) ([]byte, error)

func GetAuthorityIDByName added in v1.2.2

func GetAuthorityIDByName(ac *client.AlpaconClient, name string) (string, error)

GetAuthorityIDByName resolves an authority name to its ID. A UUID is returned as-is without an API call.

func GetCSRDetail

func GetCSRDetail(ac *client.AlpaconClient, csrId string) ([]byte, error)

func GetCertificateDetail

func GetCertificateDetail(ac *client.AlpaconClient, certId string) ([]byte, error)

func GetRevokeRequestDetail added in v1.2.0

func GetRevokeRequestDetail(ac *client.AlpaconClient, requestId string) ([]byte, error)

func RetryCSR added in v1.2.0

func RetryCSR(ac *client.AlpaconClient, csrId string) ([]byte, error)

func RetryRevokeRequest added in v1.2.0

func RetryRevokeRequest(ac *client.AlpaconClient, requestId string) ([]byte, error)

func SubmitCSR

func SubmitCSR(ac *client.AlpaconClient, csr []byte, signRequest SignRequestResponse) error

func UpdateAuthority added in v1.2.0

func UpdateAuthority(ac *client.AlpaconClient, authorityId string) ([]byte, error)

Types

type AuthorityAttributes

type AuthorityAttributes struct {
	ID               string `json:"id" table:"ID"`
	Name             string `json:"name"`
	Organization     string `json:"organization"`
	Domain           string `json:"domain"`
	RootValidDays    int    `json:"root_valid_days" table:"Root Valid Days"`
	DefaultValidDays int    `json:"default_valid_days" table:"Default Valid Days"`
	MaxValidDays     int    `json:"max_valid_days" table:"Max Valid Days"`
	Server           string `json:"server"`
	Owner            string `json:"owner"`
	SignedAt         string `json:"signed_at" table:"Signed At"`
}

func GetAuthorityList

func GetAuthorityList(ac *client.AlpaconClient) ([]AuthorityAttributes, error)

type AuthorityCreateResponse

type AuthorityCreateResponse struct {
	ID               string              `json:"id"`
	Name             string              `json:"name"`
	Organization     string              `json:"organization"`
	Domain           string              `json:"domain"`
	RootValidDays    int                 `json:"root_valid_days"`
	DefaultValidDays int                 `json:"default_valid_days"`
	MaxValidDays     int                 `json:"max_valid_days"`
	Agent            types.ServerSummary `json:"agent"`
	Owner            types.UserSummary   `json:"owner"`
	Instruction      string              `json:"instruction"`
	UpdatedAt        time.Time           `json:"updated_at"`
}

func CreateAuthority

func CreateAuthority(ac *client.AlpaconClient, authorityRequest AuthorityRequest) (AuthorityCreateResponse, error)

type AuthorityDetails

type AuthorityDetails struct {
	ID               string              `json:"id"`
	Name             string              `json:"name"`
	Organization     string              `json:"organization"`
	Domain           string              `json:"domain"`
	Storage          string              `json:"storage"`
	CrtText          string              `json:"crt_text"`
	RootValidDays    int                 `json:"root_valid_days"`
	DefaultValidDays int                 `json:"default_valid_days"`
	MaxValidDays     int                 `json:"max_valid_days"`
	RemoteIP         string              `json:"remote_ip"`
	IsConnected      bool                `json:"is_connected"`
	Status           string              `json:"status"`
	Agent            types.ServerSummary `json:"agent"`
	Owner            types.UserSummary   `json:"owner"`
	UpdatedAt        time.Time           `json:"updated_at"`
	SignedAt         time.Time           `json:"signed_at"`
	ExpiresAt        time.Time           `json:"expires_at"`
}

type AuthorityRequest

type AuthorityRequest struct {
	Name             string `json:"name"`
	Organization     string `json:"organization"`
	Domain           string `json:"domain"`
	RootValidDays    int    `json:"root_valid_days"`
	DefaultValidDays int    `json:"default_valid_days"`
	MaxValidDays     int    `json:"max_valid_days"`
	Agent            string `json:"agent"`
	Owner            string `json:"owner"`
	Install          bool   `json:"install"`
}

type AuthorityResponse

type AuthorityResponse struct {
	ID               string              `json:"id"`
	Name             string              `json:"name"`
	Organization     string              `json:"organization"`
	Domain           string              `json:"domain"`
	RootValidDays    int                 `json:"root_valid_days"`
	DefaultValidDays int                 `json:"default_valid_days"`
	MaxValidDays     int                 `json:"max_valid_days"`
	Agent            types.ServerSummary `json:"agent"`
	Owner            types.UserSummary   `json:"owner"`
	UpdatedAt        time.Time           `json:"updated_at"`
	SignedAt         time.Time           `json:"signed_at"`
	ExpiresAt        time.Time           `json:"expires_at"`
}

type AuthoritySummary added in v0.4.4

type AuthoritySummary struct {
	ID    string            `json:"id"`
	Name  string            `json:"name"`
	Owner types.UserSummary `json:"owner"`
}

type CRLResponse added in v1.2.0

type CRLResponse struct {
	CrlText   string    `json:"crl_text"`
	UpdatedAt time.Time `json:"updated_at"`
}

type CSRAttributes

type CSRAttributes struct {
	ID            string   `json:"id" table:"ID"`
	Name          string   `json:"name"` // Derived from the first domain in the CSR domain list
	Authority     string   `json:"authority"`
	DomainList    []string `json:"domain_list" table:"Domain List"`
	IpList        []string `json:"ip_list" table:"IP List"`
	Status        string   `json:"status"`
	RequestedIp   string   `json:"requested_ip" table:"Requested IP"`
	RequestedBy   string   `json:"requested_by" table:"Requested By"`
	RequestedDate string   `json:"requested_date" table:"Requested Date"`
}

func GetCSRList

func GetCSRList(ac *client.AlpaconClient, status string) ([]CSRAttributes, error)

type CSRResponse

type CSRResponse struct {
	ID          string            `json:"id"`
	Authority   AuthoritySummary  `json:"authority"`
	CommonName  string            `json:"common_name"`
	DomainList  []string          `json:"domain_list"`
	IpList      []string          `json:"ip_list"`
	ValidDays   int               `json:"valid_days"`
	Status      string            `json:"status"`
	RequestedIp string            `json:"requested_ip"`
	RequestedBy types.UserSummary `json:"requested_by"`
	AddedAt     time.Time         `json:"added_at"`
}

type CSRSubmit

type CSRSubmit struct {
	CsrText string `json:"csr_text"`
}

type Certificate

type Certificate struct {
	ID           string           `json:"id"`
	Authority    AuthoritySummary `json:"authority"`
	Csr          string           `json:"csr"`
	CrtText      string           `json:"crt_text"`
	CommonName   string           `json:"common_name"`
	SerialNumber string           `json:"serial_number"`
	ValidDays    int              `json:"valid_days"`
	Status       string           `json:"status"`
	IsRevoked    bool             `json:"is_revoked"`
	RevokedAt    *time.Time       `json:"revoked_at"`
	CanRevoke    bool             `json:"can_revoke"`
	SignedAt     time.Time        `json:"signed_at"`
	ExpiresAt    time.Time        `json:"expires_at"`
	SignedBy     string           `json:"signed_by"`
	RenewedBy    string           `json:"renewed_by"`
}

type CertificateAttributes

type CertificateAttributes struct {
	ID        string `json:"id" table:"ID"`
	Authority string `json:"authority"`
	Csr       string `json:"csr" table:"CSR"`
	ValidDays int    `json:"valid_days" table:"Valid Days"`
	SignedAt  string `json:"signed_at" table:"Signed At"`
	ExpiresAt string `json:"expires_at" table:"Expires At"`
	SignedBy  string `json:"signed_by" table:"Signed By"`
	RenewedBy string `json:"renewed_by" table:"Renewed By"`
}

func GetCertificateList

func GetCertificateList(ac *client.AlpaconClient) ([]CertificateAttributes, error)

type RevokeRequestAttributes added in v1.2.0

type RevokeRequestAttributes struct {
	ID           string `json:"id" table:"ID"`
	CommonName   string `json:"common_name" table:"Common Name"`
	Authority    string `json:"authority"`
	SerialNumber string `json:"serial_number" table:"Serial Number"`
	Status       string `json:"status"`
	RequestedBy  string `json:"requested_by" table:"Requested By"`
	AddedAt      string `json:"added_at" table:"Added At"`
}

func GetRevokeRequestList added in v1.2.0

func GetRevokeRequestList(ac *client.AlpaconClient, status string, certificate string) ([]RevokeRequestAttributes, error)

type RevokeRequestCreate added in v1.2.0

type RevokeRequestCreate struct {
	Certificate     string `json:"certificate"`
	Reason          int    `json:"reason"`
	RequestedReason string `json:"requested_reason,omitempty"`
}

type RevokeRequestResponse added in v1.2.0

type RevokeRequestResponse struct {
	ID              string             `json:"id"`
	Certificate     string             `json:"certificate"`
	Authority       AuthoritySummary   `json:"authority"`
	CommonName      string             `json:"common_name"`
	SerialNumber    string             `json:"serial_number"`
	Reason          int                `json:"reason"`
	Status          string             `json:"status"`
	RequestedReason string             `json:"requested_reason"`
	RequestedBy     types.UserSummary  `json:"requested_by"`
	ApprovedBy      *types.UserSummary `json:"approved_by"`
	DeniedBy        *types.UserSummary `json:"denied_by"`
	AddedAt         time.Time          `json:"added_at"`
	ErrorMessage    string             `json:"error_message"`
	HandledAt       *time.Time         `json:"handled_at"`
}

func CreateRevokeRequest added in v1.2.0

func CreateRevokeRequest(ac *client.AlpaconClient, request RevokeRequestCreate) (RevokeRequestResponse, error)

type SignRequest

type SignRequest struct {
	DomainList []string `json:"domain_list"`
	IpList     []string `json:"ip_list"`
	// ValidDays is omitted when zero so the server applies the CA's default_valid_days.
	ValidDays   int    `json:"valid_days,omitempty"`
	CsrText     string `json:"csr_text,omitempty"`
	RequestedBy string `json:"requested_by,omitempty"`
}

type SignRequestDetail added in v1.0.0

type SignRequestDetail struct {
	ID         string `json:"id"`
	CommonName string `json:"common_name"`
	Status     string `json:"status"`
	CrtText    string `json:"crt_text"`
}

type SignRequestResponse

type SignRequestResponse struct {
	ID           string            `json:"id"`
	Organization string            `json:"organization"`
	CommonName   string            `json:"common_name"`
	DomainList   []string          `json:"domain_list"`
	IpList       []string          `json:"ip_list"`
	ValidDays    int               `json:"valid_days"`
	Status       string            `json:"status"`
	RequestedIp  string            `json:"requested_ip"`
	RequestedBy  types.UserSummary `json:"requested_by"`
	SubmitURL    string            `json:"submit_url"`
}

func CreateSignRequest

func CreateSignRequest(ac *client.AlpaconClient, signRequest SignRequest) (SignRequestResponse, error)

Jump to

Keyboard shortcuts

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