models

package
v0.0.0-...-a7af930 Latest Latest
Warning

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

Go to latest
Published: May 21, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CACount

type CACount struct {
	// Unique ID
	Id int

	// The CA cert
	CertificateId int
	Certificate   *Certificate

	// Last Serial number used
	SerialNumber int
}

Model for CAs to keep track of which serial number was last issued

func (*CACount) PostGet

func (c *CACount) PostGet(exe gorp.SqlExecutor) error

After getting a Revoked Certificate from db, set Certificate

func (*CACount) PreInsert

func (c *CACount) PreInsert(_ gorp.SqlExecutor) error

Before inserting a Revoked Certificate into the db, make sure that CertificateId is set

type Certificate

type Certificate struct {
	// Unique ID
	Id int
	// PEM and Private key as can be written to file
	PEM, PrivateKey []byte
	// The x509 CN of the certificate
	CommonName string
	// The type of key used
	KeyType

	SerialNumber int

	// Whether the certificate represents a CA, and whether the key is encrypted
	CA, Encrypted bool

	// The ID of the project this cert is associated with
	ProjectId int

	// The Project this cert is associated with
	Project *Project
}

Certificate model as stored in the database

func (*Certificate) PostGet

func (c *Certificate) PostGet(exe gorp.SqlExecutor) error

After get a cert from the db, set the project based on the ProjectId

func (*Certificate) PreInsert

func (c *Certificate) PreInsert(_ gorp.SqlExecutor) error

Before inserting a cert into the db, make sure that ProjectId is set

type CertificateOneTimeDownload

type CertificateOneTimeDownload struct {
	Id            int
	CertificateId int
	Hash          string

	Certificate *Certificate
}

Represents a One Time link to download a key

func (*CertificateOneTimeDownload) PostGet

After getting CertOneTimeDownload from db, set Certificate

func (*CertificateOneTimeDownload) PreInsert

Before inserting a certOneTimeDownload into the db, make sure that CertificateId is set

type CertificateOwnership

type CertificateOwnership struct {
	Id                    int
	CertificateId, UserId int

	Certificate *Certificate
	User        *User
}

Join a certificate to the user that owns it

func (*CertificateOwnership) PostGet

func (c *CertificateOwnership) PostGet(exe gorp.SqlExecutor) error

After getting certificate ownership, set Certificate and User

func (*CertificateOwnership) PreInsert

func (c *CertificateOwnership) PreInsert(_ gorp.SqlExecutor) error

Before inserting a cert ownership into the db, make sure that userID and CertificateId are set

type CertificateRequest

type CertificateRequest struct {
	// Unique ID
	Id int
	// PEM and Private key as can be written to file
	CSR []byte

	// The ID of the Certificate requested to be signed by
	RequestedCAId int
	// The Certificate requested to be signed by
	RequestedCA *Certificate

	// The ID of the project this cert is associated with
	ProjectId int

	// The Project this cert is associated with
	Project *Project

	// The user that submitted the CSR
	UserId int
	User   *User
}

Certificate model as stored in the database

func (*CertificateRequest) PostGet

func (c *CertificateRequest) PostGet(exe gorp.SqlExecutor) error

After getting a template from the db, set the project based on the ProjectId and RequestedCAID

func (*CertificateRequest) PreInsert

func (c *CertificateRequest) PreInsert(_ gorp.SqlExecutor) error

Before inserting a certificate request into the db, make sure that ProjectId and RequestedCAID are set

type CertificateTemplate

type CertificateTemplate struct {
	// Unique ID
	Id   int
	Name string

	Country, State, City           string
	Organization, OrganizationUnit string
	Expires                        string
	PrivateKeyType                 string
	IsCA                           bool
	KeyUses, ExtKeyUses            string
	SignedBy                       int

	// The ID of the project this cert is associated with
	ProjectId int

	// The Project this cert is associated with
	Project *Project
}

Certificate template model as stored in the database

func (*CertificateTemplate) PostGet

func (c *CertificateTemplate) PostGet(exe gorp.SqlExecutor) error

After getting a template from the db, set the project based on the ProjectId

func (*CertificateTemplate) PreInsert

func (c *CertificateTemplate) PreInsert(_ gorp.SqlExecutor) error

Before inserting a template into the db, make sure that ProjectId is set

type FullCertificate

type FullCertificate struct {
	Country, State, City           string
	Organization, OrganizationUnit string
	CommonName                     string
	Expires                        string
	PrivateKeyType                 string
	IsCA                           bool
	KeyUses, ExtKeyUses            []string
	SignedBy                       int

	EncryptionKey   string
	CAEncryptionKey string
}

The Full data associated with a certificate

type KeyType

type KeyType int

Types of Key used

const (
	RSA KeyType = iota
	ECDSA
)

type Project

type Project struct {
	Id int

	Name, Description string
	/*
		If project is public any one with access to the website can see project and access public certs for certificates in project
		If not, only project owners and members will have visibility
	*/
	Public bool
}

Project model as stored in database

type ProjectMembership

type ProjectMembership struct {
	Id                int
	ProjectId, UserId int

	Admin bool

	Project *Project
	User    *User
}

Model for mapping a user to a project that they are a member of

func (*ProjectMembership) PostGet

func (c *ProjectMembership) PostGet(exe gorp.SqlExecutor) error

func (*ProjectMembership) PreInsert

func (c *ProjectMembership) PreInsert(_ gorp.SqlExecutor) error

type RevokedCertificate

type RevokedCertificate struct {
	Id            int
	CertificateId int

	Certificate *Certificate
}

Represents a revoked certificate, used to generate

func (*RevokedCertificate) PostGet

func (c *RevokedCertificate) PostGet(exe gorp.SqlExecutor) error

After getting a Revoked Certificate from db, set Certificate

func (*RevokedCertificate) PreInsert

func (c *RevokedCertificate) PreInsert(_ gorp.SqlExecutor) error

Before inserting a Revoked Certificate into the db, make sure that CertificateId is set

type Server

type Server struct {
	Id  int
	URL string
}

type User

type User struct {
	Id                       int
	Email                    string
	Username, Name, Password string // Password is not stored in the DB
	HashedPassword           []byte
	IsAdmin                  bool
}

User model as stored in the database

func (*User) String

func (u *User) String() string

func (*User) Validate

func (user *User) Validate(v *revel.Validation)

Jump to

Keyboard shortcuts

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