wrap

package
v0.0.0-...-01f5b33 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateKey

func CreateKey(category string, bit uint) []byte

CreateKey create specific x509 private key, and returns the DER data

Types

type CertTemplate

type CertTemplate x509.Certificate

CertTemplate is a x509.Certificate wrapper for template use

func CreateTemplate

func CreateTemplate(subject *pkix.Name, keyID []byte, serial int64) *CertTemplate

CreateTemplate create a most simple CertTemplate

func (*CertTemplate) GetRaw

func (cert *CertTemplate) GetRaw() *x509.Certificate

GetRaw return the raw x509.Certificate

func (*CertTemplate) SetAlgorithm

func (cert *CertTemplate) SetAlgorithm(category string, name string)

SetAlgorithm can simply set the algorithm that used for validate the cert itself

func (*CertTemplate) SetConstraint

func (cert *CertTemplate) SetConstraint(isCA, LimitPathLen bool, pathLen int)

SetConstraint can simply set if the cert can be a CA While cert is a CA, you can limit the sub CA path length

func (*CertTemplate) SetExpire

func (cert *CertTemplate) SetExpire(year, month, day int)

SetExpire can simply set the expire date (start from today 00:00)

func (*CertTemplate) SetExtUsage

func (cert *CertTemplate) SetExtUsage(usage []int)

SetExtUsage can simply set the cert of the list x509.ExtKeyUsage

func (*CertTemplate) SetUsage

func (cert *CertTemplate) SetUsage(usage []int)

SetUsage can simply set the cert basic usage input the index of the x509.KeyUsage (start from 1)

type Subject

type Subject pkix.Name

Subject is a pkix.Name wrapper for template use

func CreateSubject

func CreateSubject(name string) *Subject

CreateSubject create a most simple Subject

func (*Subject) GetKeyID

func (s *Subject) GetKeyID() []byte

GetKeyID return the hash sum of this Subject

func (*Subject) GetRaw

func (s *Subject) GetRaw() *pkix.Name

GetRaw return the raw pkix.Name after fill up the template

func (*Subject) SetLocation

func (s *Subject) SetLocation(country, province, city string)

SetLocation can simply set the location

func (*Subject) SetOrg

func (s *Subject) SetOrg(org, orgUnit string)

SetOrg can simply set the org name and org unit name

func (*Subject) SetSerial

func (s *Subject) SetSerial(serial string)

SetSerial can simply set the serial of the subject

Jump to

Keyboard shortcuts

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