cert

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

* Nuts registry * Copyright (C) 2020. Nuts community * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. *

* Nuts registry * Copyright (C) 2020. Nuts community * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. *

Index

Constants

This section is empty.

Variables

View Source
var OIDAGBCode = asn1.ObjectIdentifier{2, 16, 840, 1, 113883, 2, 4, 6, 1}

Functions

func OrganisationCertificateRequest

func OrganisationCertificateRequest(vendorName string, organisationID core.PartyID, organisationName string, domain string) (x509.CertificateRequest, error)

OrganisationCertificateRequest creates a CertificateRequest template for issuing an organisation. The certificate should be issued by the vendor CA. Parameters 'domain' and 'env' are optional.

func VendorCertificateRequest

func VendorCertificateRequest(vendorID core.PartyID, vendorName string, qualifier string, domain string) (x509.CertificateRequest, error)

VendorCertificateRequest creates a CertificateRequest template for issuing a vendor certificate.

vendorID:      URN-OID-encoded ID of the vendor
vendorName:    Name of the vendor
qualifier:     (optional) Qualifier for the certificate, which will be postfixed to Subject.CommonName
domain:        Domain the vendor operates in, e.g. "healthcare"
env:           (optional) Environment for the certificate, e.g. "Test" or "Dev", which will be postfixed to Subject.CommonName

Types

type NutsCertificate added in v0.15.0

type NutsCertificate x509.Certificate

NutsCertificate is a type alias for a regular x509.Certificate. It provides convenience methods for retrieving Nuts specific properties from the certificate.

func NewNutsCertificate added in v0.15.0

func NewNutsCertificate(certificate *x509.Certificate) *NutsCertificate

Efficiently converts the *x509.Certificate as *NutsCertificate

func (NutsCertificate) GetDomain added in v0.15.0

func (c NutsCertificate) GetDomain() (string, error)

GetDomain tries to get the Nuts Domain from the certificate. If the certificate doesn't require the extension, an empty string is returned. If something else goes wrong, the error is returned.

func (NutsCertificate) GetOrganizationID added in v0.15.0

func (c NutsCertificate) GetOrganizationID() (core.PartyID, error)

GetOrganizationID tries to get the organization ID (AGB-code) from the certificate SAN. If it doesn't exist, an empty identifier is returned without error. If an error occurs, an empty identifier is returned alongside the error.

func (NutsCertificate) GetVendorID added in v0.15.0

func (c NutsCertificate) GetVendorID() (core.PartyID, error)

GetVendorID tries to get the vendor ID from the certificate SAN. If it doesn't exist, an empty identifier is returned without error. If an error occurs, an empty identifier is returned alongside the error.

func (NutsCertificate) MarshalJSON added in v0.16.0

func (c NutsCertificate) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ASN.1 representation of the certificate as base64 JSON string.

func (*NutsCertificate) UnmarshalJSON added in v0.16.0

func (c *NutsCertificate) UnmarshalJSON(bytes []byte) error

UnmarshalJSON unmarshals a JSON string containing a base64 encoded ASN.1 certificate into a x509.Certificate.

Jump to

Keyboard shortcuts

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