x509util

package
v0.0.0-...-ef5c1ef Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCertificateFromPEM

func ParseCertificateFromPEM(pemData []byte) (cert *x509.Certificate, issuer *ELSIName, subject *ELSIName, err error)

ParseCertificate extracts the first certificate from the given PEM string

func ParseEIDASCertB64Der

func ParseEIDASCertB64Der(certDer string) (cert *x509.Certificate, issuer *ELSIName, subject *ELSIName, err error)

func ParseEIDASCertDer

func ParseEIDASCertDer(rawCert []byte) (cert *x509.Certificate, issuer *ELSIName, subject *ELSIName, err error)

Types

type ELSIName

type ELSIName struct {
	Country                string `json:"country,omitempty"`
	Organization           string `json:"organization,omitempty"`
	OrganizationalUnit     string `json:"organizational_unit,omitempty"`
	Locality               string `json:"locality,omitempty"`
	Province               string `json:"province,omitempty"`
	StreetAddress          string `json:"street_address,omitempty"`
	PostalCode             string `json:"postal_code,omitempty"`
	SerialNumber           string `json:"serial_number,omitempty"`
	CommonName             string `json:"common_name,omitempty"`
	GivenName              string `json:"given_name,omitempty"`
	Surname                string `json:"surname,omitempty"`
	OrganizationIdentifier string `json:"organization_identifier,omitempty"`
	EmailAddress           string `json:"email_address,omitempty"`
}

ELSIName represents an X.509 distinguished name. This only includes the common elements of a DN. Note that ELSIName is only an approximation of the X.509 structure. If an accurate representation is needed, asn1.Unmarshal the raw subject or issuer as an [RDNSequence].

func ParseEIDASNameFromATVSequence

func ParseEIDASNameFromATVSequence(rdn []pkix.AttributeTypeAndValue) *ELSIName

func (ELSIName) String

func (e ELSIName) String() string

func (ELSIName) ToATVSequence

func (n ELSIName) ToATVSequence() (ret []pkix.AttributeTypeAndValue)

type KeyParams

type KeyParams struct {
	Ed25519Key bool
	EcdsaCurve string
	RsaBits    int
	ValidFrom  string
	ValidFor   time.Duration
}

type PEMCert

type PEMCert []byte

func NewCACertificate

func NewCACertificate(subAttrs ELSIName, keyparams KeyParams) (subPrivKey jwk.Key, subCert PEMCert, err error)

func NewCAELSICertificate

func NewCAELSICertificate(subAttrs ELSIName, keyparams KeyParams) (subPrivKey jwk.Key, subCert PEMCert, err error)

func NewCertificate

func NewCertificate(issCert PEMCert, issPrivKey jwk.Key, subAttrs ELSIName, keyparams KeyParams) (subPrivKey jwk.Key, subCert PEMCert, err error)

Jump to

Keyboard shortcuts

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