certdehydrate

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: GPL-3.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillRehydratedCertTemplate

func FillRehydratedCertTemplate(template x509.Certificate, name string) ([]byte, error)

FillRehydratedCertTemplate fills in the domain name (and all dependent fields) to an x509 certificate that was returned by RehydrateCert, and returns a []byte suitable for inserting into a TLS trust store.

func RehydrateCert

func RehydrateCert(dehydrated *DehydratedCertificate) (*x509.Certificate, error)

RehydrateCert converts a dehydrated certificate into a standard x509 certificate, but does not fill in the domain name or any fields that depend on it. The resulting certificate is intended to be used as input to FillRehydratedCertTemplate.

Types

type DehydratedCertificate

type DehydratedCertificate struct {
	PubkeyB64          string
	NotBeforeScaled    int64
	NotAfterScaled     int64
	SignatureAlgorithm int64
	SignatureB64       string
}

A DehydratedCertificate represents the (nearly) minimal set of data required to deterministically construct a valid x509 certificate when combined with a domain name. See the Dehydrated TLS Certificates specification at: https://github.com/namecoin/proposals/blob/master/ifa-0003.md TODO: add a version field

func DehydrateCert

func DehydrateCert(cert *x509.Certificate) (*DehydratedCertificate, error)

DehydrateCert dehydrates a certificate. If the input certificate is not compatible with the Dehydrated TLS Certificates specification, the resulting dehydrated certificate will not rehydrate into a valid x509 certificate.

func ParseDehydratedCert

func ParseDehydratedCert(data interface{}) (*DehydratedCertificate, error)

ParseDehydratedCert parses a dehydrated certificate from an interface as would be returned by a JSON Unmarshaler.

func (*DehydratedCertificate) SerialNumber

func (dehydrated *DehydratedCertificate) SerialNumber(name string) ([]byte, error)

SerialNumber calculates the certificate serial number according to the Dehydrated TLS Certificates specification.

func (*DehydratedCertificate) String

func (dehydrated *DehydratedCertificate) String() string

Jump to

Keyboard shortcuts

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