legacyx509

package
v0.28.0 Latest Latest
Warning

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

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

Documentation

Overview

Package legacyx509 is a copy of certain parts of Go's crypto/x509 package. It is based on Go 1.23, and has just the parts copied over required for parsing X509 certificates.

The copy in this repository is intended to be used for preparing a SCEP request emulating a Windows SCEP client. The Windows SCEP client marks the authority key identifier as critical in the self-signed SCEP enrolment certificate, which fails to parse using the standard X509 parser in Go 1.23 and later.

This is itself a copy from the copy in our PKCS7 package. We currently don't intend to maintain that in an importable package, since we only need these copies for testing purposes, hence needing another copy of the code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCertificates

func ParseCertificates(der []byte) ([]*stdx509.Certificate, error)

ParseCertificates parses one or more certificates from the given ASN.1 DER data. The certificates must be concatenated with no intermediate padding.

Types

type ExtKeyUsage

type ExtKeyUsage int

ExtKeyUsage represents an extended set of actions that are valid for a given key. Each of the ExtKeyUsage* constants define a unique action.

const (
	ExtKeyUsageAny ExtKeyUsage = iota
	ExtKeyUsageServerAuth
	ExtKeyUsageClientAuth
	ExtKeyUsageCodeSigning
	ExtKeyUsageEmailProtection
	ExtKeyUsageIPSECEndSystem
	ExtKeyUsageIPSECTunnel
	ExtKeyUsageIPSECUser
	ExtKeyUsageTimeStamping
	ExtKeyUsageOCSPSigning
	ExtKeyUsageMicrosoftServerGatedCrypto
	ExtKeyUsageNetscapeServerGatedCrypto
	ExtKeyUsageMicrosoftCommercialCodeSigning
	ExtKeyUsageMicrosoftKernelCodeSigning
)

type KeyUsage

type KeyUsage int

KeyUsage represents the set of actions that are valid for a given key. It's a bitmap of the KeyUsage* constants.

const (
	KeyUsageDigitalSignature KeyUsage = 1 << iota
	KeyUsageContentCommitment
	KeyUsageKeyEncipherment
	KeyUsageDataEncipherment
	KeyUsageKeyAgreement
	KeyUsageCertSign
	KeyUsageCRLSign
	KeyUsageEncipherOnly
	KeyUsageDecipherOnly
)

type OID

type OID struct {
	// contains filtered or unexported fields
}

An OID represents an ASN.1 OBJECT IDENTIFIER.

func OIDFromInts

func OIDFromInts(oid []uint64) (OID, error)

OIDFromInts creates a new OID using ints, each integer is a separate component.

func ParseOID

func ParseOID(oid string) (OID, error)

ParseOID parses a Object Identifier string, represented by ASCII numbers separated by dots.

func (OID) AppendBinary

func (o OID) AppendBinary(b []byte) ([]byte, error)

AppendBinary implements encoding.BinaryAppender

func (OID) AppendText

func (o OID) AppendText(b []byte) ([]byte, error)

AppendText implements encoding.TextAppender

func (OID) Equal

func (oid OID) Equal(other OID) bool

Equal returns true when oid and other represents the same Object Identifier.

func (OID) EqualASN1OID

func (oid OID) EqualASN1OID(other asn1.ObjectIdentifier) bool

EqualASN1OID returns whether an OID equals an asn1.ObjectIdentifier. If asn1.ObjectIdentifier cannot represent the OID specified by oid, because a component of OID requires more than 31 bits, it returns false.

func (OID) MarshalBinary

func (o OID) MarshalBinary() ([]byte, error)

MarshalBinary implements encoding.BinaryMarshaler

func (OID) MarshalText

func (o OID) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler

func (OID) String

func (oid OID) String() string

Strings returns the string representation of the Object Identifier.

func (*OID) UnmarshalBinary

func (o *OID) UnmarshalBinary(b []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler

func (*OID) UnmarshalText

func (o *OID) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler

type PublicKeyAlgorithm

type PublicKeyAlgorithm int
const (
	UnknownPublicKeyAlgorithm PublicKeyAlgorithm = iota
	RSA
	DSA // Only supported for parsing.
	ECDSA
	Ed25519
)

func (PublicKeyAlgorithm) String

func (algo PublicKeyAlgorithm) String() string

type SignatureAlgorithm

type SignatureAlgorithm int
const (
	UnknownSignatureAlgorithm SignatureAlgorithm = iota

	MD2WithRSA  // Unsupported.
	MD5WithRSA  // Only supported for signing, not verification.
	SHA1WithRSA // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses.
	SHA256WithRSA
	SHA384WithRSA
	SHA512WithRSA
	DSAWithSHA1   // Unsupported.
	DSAWithSHA256 // Unsupported.
	ECDSAWithSHA1 // Only supported for signing, and verification of CRLs, CSRs, and OCSP responses.
	ECDSAWithSHA256
	ECDSAWithSHA384
	ECDSAWithSHA512
	SHA256WithRSAPSS
	SHA384WithRSAPSS
	SHA512WithRSAPSS
	PureEd25519
)

func (SignatureAlgorithm) String

func (algo SignatureAlgorithm) String() string

Jump to

Keyboard shortcuts

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