Documentation ¶
Index ¶
- Variables
- func AppendExpiryToCSR(expiry time.Duration, csr *x509.CertificateRequest)
- func GetExpiryValue(csr *x509.CertificateRequest) time.Duration
- type Attribute
- type AttributeRequest
- type Attributes
- type Mgr
- func (mgr *Mgr) AddAttributesToCert(attrs *Attributes, cert *x509.Certificate) error
- func (mgr *Mgr) AddAttributesToCertRequest(attrs *Attributes, cert *x509.CertificateRequest) error
- func (mgr *Mgr) GetAttributesFromCert(cert *x509.Certificate) (*Attributes, error)
- func (mgr *Mgr) ProcessAttributeRequests(requests []AttributeRequest, attributes []Attribute) (*Attributes, error)
- func (mgr *Mgr) ProcessAttributeRequestsForCert(requests []AttributeRequest, attributes []Attribute, cert *x509.Certificate) error
- func (mgr *Mgr) ToPkixExtension(attrs *Attributes) (pkix.Extension, error)
Constants ¶
This section is empty.
Variables ¶
var ( // AttrOID is the ASN.1 object identifier for an attribute extension in an // X509 certificate AttrOID = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7, 8, 1} ExpiryOID = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7, 8, 2} // AttrOIDString is the string version of AttrOID AttrOIDString = "1.2.3.4.5.6.7.8.1" )
Functions ¶
func AppendExpiryToCSR ¶
func AppendExpiryToCSR(expiry time.Duration, csr *x509.CertificateRequest)
AppendExpiryToCSR
func GetExpiryValue ¶
func GetExpiryValue(csr *x509.CertificateRequest) time.Duration
Types ¶
type Attribute ¶
type Attribute interface { // GetName returns the name of the attribute GetName() string // GetValue returns the value of the attribute GetValue() interface{} }
Attribute is a name/value pair
type AttributeRequest ¶
type AttributeRequest interface { // GetName returns the name of an attribute GetName() string // IsRequired returns true if the attribute is required IsRequired() bool }
AttributeRequest is a request for an attribute
type Attributes ¶
type Attributes struct {
Attrs map[string]interface{} `json:"attrs"`
}
Attributes contains attribute names and values
func (*Attributes) Contains ¶
func (a *Attributes) Contains(name string) bool
Contains returns true if the named attribute is found
func (*Attributes) Names ¶
func (a *Attributes) Names() []string
Names returns the names of the attributes
func (*Attributes) True ¶
func (a *Attributes) True(name string) error
True returns nil if the value of attribute 'name' is true; otherwise, an appropriate error is returned.
type Mgr ¶
type Mgr struct{}
Mgr is the attribute manager and is the main object for this package
func (*Mgr) AddAttributesToCert ¶
func (mgr *Mgr) AddAttributesToCert(attrs *Attributes, cert *x509.Certificate) error
AddAttributesToCert adds public attribute info to an X509 certificate.
func (*Mgr) AddAttributesToCertRequest ¶
func (mgr *Mgr) AddAttributesToCertRequest(attrs *Attributes, cert *x509.CertificateRequest) error
AddAttributesToCertRequest ...
func (*Mgr) GetAttributesFromCert ¶
func (mgr *Mgr) GetAttributesFromCert(cert *x509.Certificate) (*Attributes, error)
GetAttributesFromCert gets the attributes from a certificate.
func (*Mgr) ProcessAttributeRequests ¶
func (mgr *Mgr) ProcessAttributeRequests(requests []AttributeRequest, attributes []Attribute) (*Attributes, error)
ProcessAttributeRequests takes an array of attribute requests and an identity's attributes and returns an Attributes object containing the requested attributes.
func (*Mgr) ProcessAttributeRequestsForCert ¶
func (mgr *Mgr) ProcessAttributeRequestsForCert(requests []AttributeRequest, attributes []Attribute, cert *x509.Certificate) error
ProcessAttributeRequestsForCert add attributes to an X509 certificate, given attribute requests and attributes.
func (*Mgr) ToPkixExtension ¶
func (mgr *Mgr) ToPkixExtension(attrs *Attributes) (pkix.Extension, error)
ToPkixExtension ...