utils

package
v0.0.1-beta3 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OIDExtensionKeyUsage         = []int{2, 5, 29, 15}
	OIDExtensionExtendedKeyUsage = []int{2, 5, 29, 37}
)

Copied from x509.go

View Source
var (
	// OIDSubjectAltName is the OID for subjectAltName
	OIDSubjectAltName = asn1.ObjectIdentifier{2, 5, 29, 17}
	// OIDReceptorName is the OID for a Receptor node ID
	OIDReceptorName = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 2312, 19, 1}
	// OIDHLFExtension is the OID for the HLF extensions 1.2.3.4.5.6.7.8.1
	OIDHLFExtension = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 7, 8, 1}
)

Functions

func BuildASN1ExtKeyUsageRequest

func BuildASN1ExtKeyUsageRequest(usage x509.ExtKeyUsage) (pkix.Extension, error)

func BuildASN1KeyUsageRequest

func BuildASN1KeyUsageRequest(usage x509.KeyUsage) (pkix.Extension, error)

Adapted from x509.go

func BuildHLFExtension

func BuildHLFExtension() (pkix.Extension, error)

func EncodeX509Certificate

func EncodeX509Certificate(crt *x509.Certificate) []byte

func EncodeX509CertificatesToPem

func EncodeX509CertificatesToPem(crts []*x509.Certificate) []string

func ExtKeyUsageFromOID

func ExtKeyUsageFromOID(oid asn1.ObjectIdentifier) (eku x509.ExtKeyUsage, ok bool)

func MakeReceptorSAN

func MakeReceptorSAN(DNSNames []string, IPAddresses []net.IP, NodeIDs []string) (pkix.Extension, error)

MakeReceptorSAN generates a subjectAltName extension, optionally containing Receptor names

func OIDFromExtKeyUsage

func OIDFromExtKeyUsage(eku x509.ExtKeyUsage) (oid asn1.ObjectIdentifier, ok bool)

OIDFromExtKeyUsage returns the ASN1 Identifier for a x509.ExtKeyUsage

func ParseX509Certificate

func ParseX509Certificate(contents []byte) (*x509.Certificate, error)

func ParseX509CertificateBase64

func ParseX509CertificateBase64(b64Cert string) (*x509.Certificate, error)

Types

type OtherNameEncode

type OtherNameEncode struct {
	OID   asn1.ObjectIdentifier
	Value UTFString `asn1:"tag:0"`
}

OtherNameEncode is used for encoding the OtherName field of an x.509 subjectAltName

type UTFString

type UTFString struct {
	A string `asn1:"utf8"`
}

UTFString is used for encoding a UTF-8 string

Jump to

Keyboard shortcuts

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