dto

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MPL-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StatusValid   = "issued"
	StatusRevoked = "revoked"
	StatusExpired = "expired"
)
View Source
const DefaultQueryParam = "{1,50}"

Variables

This section is empty.

Functions

This section is empty.

Types

type CAType

type CAType int
const (
	DmsEnroller CAType = iota
	Pki
)

func ParseCAType

func ParseCAType(s string) (CAType, error)

func (CAType) String

func (c CAType) String() string

func (CAType) ToVaultPath

func (c CAType) ToVaultPath() string

type Cert

type Cert struct {
	// The status of the CA
	// required: true
	// example: issued | expired
	Status string `json:"status,omitempty"`

	// The serial number of the CA
	// required: true
	// example: 7e:36:13:a5:31:9f:4a:76:10:64:2e:9b:0a:11:07:b7:e6:3e:cf:94
	SerialNumber string `json:"serial_number,omitempty"`

	// The name/alias of the CA
	// required: true
	// example: Lamassu-CA
	Name string `json:"name,omitempty"`

	KeyMetadata PrivateKeyMetadataWithStregth `json:"key_metadata"`

	Subject Subject `json:"subject"`

	CertContent CertContent `json:"certificate"`

	// Expiration period of the new emmited CA
	// required: true
	// example: 262800h
	CaTTL int `json:"ca_ttl,omitempty"`

	EnrollerTTL int `json:"enroller_ttl,omitempty"`

	ValidFrom           string `json:"valid_from"`
	ValidTo             string `json:"valid_to"`
	RevocationTimestamp int64  `json:"revocation_timestamp,omitempty"`
}

type CertContent

type CertContent struct {
	CerificateBase64 string `json:"pem_base64, omitempty"`
	PublicKeyBase64  string `json:"public_key_base64"`
}

type CreateCARequestPayload

type CreateCARequestPayload struct {
	KeyMetadata PrivateKeyMetadata `json:"key_metadata" validate:"required"`

	Subject Subject `json:"subject"`

	CaTTL       int `json:"ca_ttl" validate:"required"`
	EnrollerTTL int `json:"enroller_ttl" validate:"gt=0"`
}

type GetCasResponse

type GetCasResponse struct {
	TotalCas int    `json:"total_cas"`
	CAs      []Cert `json:"cas,omitempty"`
}

type ImportCARequestPayload

type ImportCARequestPayload struct {
	EnrollerTTL int    `json:"enroller_ttl" validate:"required"`
	Crt         string `json:"crt" validate:"base64"`
	PrivateKey  string `json:"private_key" validate:"base64"`
}

type IssuedCertsResponse

type IssuedCertsResponse struct {
	TotalCerts int    `json:"total_certs"`
	Certs      []Cert `json:"certs,omitempty"`
}

type KeyType

type KeyType string
const (
	RSA KeyType = "RSA"
	EC  KeyType = "EC"
)

func ParseKeyType

func ParseKeyType(s string) (KeyType, error)

func (KeyType) String

func (c KeyType) String() string

type OrderOptions

type OrderOptions struct {
	Order string `json:"order"`
	Field string `json:"field"`
}

type PaginationOptions

type PaginationOptions struct {
	Page   int `json:"page"`
	Offset int `json:"offset"`
}

type PrivateKey

type PrivateKey struct {
	Key     interface{}
	KeyType KeyType
}

func (*PrivateKey) GetPEMString

func (pk *PrivateKey) GetPEMString() (string, error)

type PrivateKeyMetadata

type PrivateKeyMetadata struct {
	// Algorithm used to create CA key
	// required: true
	// example: RSA
	KeyType string `json:"type" validate:"oneof='RSA' 'EC'"`

	// Length used to create CA key
	// required: true
	// example: 4096
	KeyBits int `json:"bits"  validate:"required"`
}

type PrivateKeyMetadataWithStregth

type PrivateKeyMetadataWithStregth struct {
	// Algorithm used to create CA key
	// required: true
	// example: RSA
	KeyType string `json:"type" validate:"oneof='RSA' 'EC'"`

	// Length used to create CA key
	// required: true
	// example: 4096
	KeyBits int `json:"bits"`

	// Strength of the key used to the create CA
	// required: true
	// example: low
	KeyStrength string `json:"strength"`
}

type QueryParameters

type QueryParameters struct {
	Filter     string            `json:"filter"`
	Order      OrderOptions      `json:"order_options"`
	Pagination PaginationOptions `json:"pagination_options"`
}

type SignPayload

type SignPayload struct {
	Csr          string `json:"csr" validate:"base64"`
	CommonName   string `json:"cn"`
	SignVerbatim bool   `json:"sign_verbatim"`
}

type SignResponse

type SignResponse struct {
	Crt   string `json:"crt"`
	CaCrt string `json:"cacrt"`
}

type Stats

type Stats struct {
	IssuedCerts int       `json:"issued_certs"`
	CAs         int       `json:"cas"`
	ScanDate    time.Time `json:"scan_date"`
}

type Subject

type Subject struct {
	// Common name of the CA certificate
	// required: true
	// example: Lamassu-Root-CA1-RSA4096
	CommonName string `json:"common_name" validate:"required"`

	// Organization of the CA certificate
	// required: true
	// example: Lamassu IoT
	Organization string `json:"organization"`

	// Organization Unit of the CA certificate
	// required: true
	// example: Lamassu IoT department 1
	OrganizationUnit string `json:"organization_unit"`

	// Country Name of the CA certificate
	// required: true
	// example: ES
	Country string `json:"country"`

	// State of the CA certificate
	// required: true
	// example: Guipuzcoa
	State string `json:"state"`

	// Locality of the CA certificate
	// required: true
	// example: Arrasate
	Locality string `json:"locality"`
}

Jump to

Keyboard shortcuts

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