certificate

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package certificate provides en: structure of the Container representation in the asn.1, methods for this structure

and the decoding function from DER

ru: структуру представления Container в asn.1, методы для этой структуры

и функцию декодирования из DER

asn.1 - Abstract Syntax Notation One (ASN. 1) is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way. It is broadly used in telecommunications and computer networking, and especially in cryptography. https://en.wikipedia.org/wiki/ASN.1

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCertificatesEqual

func IsCertificatesEqual(a, b *Container) bool

func VerifyPartialChain

func VerifyPartialChain(cert *Container, parents []*Container) error

VerifyPartialChain checks that a given cert is issued by the first parent in the list, then continue down the path. It doesn't require the last parent to be a root CA, or to be trusted in any truststore. It simply verifies that the chain provided, albeit partial, makes sense.

Types

type Container

type Container struct {
	Raw                asn1.RawContent
	TBSCertificate     tbscertificate.Container
	SignatureAlgorithm pkix.AlgorithmIdentifier
	SignatureValue     asn1.BitString
}

func DecodeDER

func DecodeDER(derData containers.DER) ([]*Container, error)

DecodeDER en: parses a multiple certificates from the given ASN.1 DER data. ru: парсит DER данные и выдает слайс сертификатов

func DecodePEM

func DecodePEM(pemData containers.PEM) ([]*Container, error)

DecodePEM en: parses a multiple certificates from the given ASN.1 PEM data. ru: парсит PEM данные и выдает слайс сертификатов

func DecodePEMFile

func DecodePEMFile(file string) ([]*Container, error)

DecodePEMFile en: parses a multiple certificates from the given ASN.1 PEM file. ru: парсит указанный файл в формате PEM и возвращает слайс сертификатов

func (*Container) CheckSignature

func (c *Container) CheckSignature(
	algo *signaturealgorithm.SignatureAlgorithm,
	signedSource,
	signature []byte,
) (err error)

CheckSignature - Verifies signature over certificate public key

func (*Container) CheckSignatureFrom

func (c *Container) CheckSignatureFrom(parent *Container) error

CheckSignatureFrom verifies that the signature on c is a valid signature from parent.

func (*Container) EncodeToDER

func (c *Container) EncodeToDER() (containers.DER, error)

EncodeToDER en: convert certificate to DER data. ru: конвертирует сертификат в DER данные

func (*Container) EncodeToPEM

func (c *Container) EncodeToPEM() (containers.PEM, error)

EncodeToPEM en: convert certificate to PEM data. ru: конвертирует сертификат в PEM данные

func (*Container) GetSource

func (c *Container) GetSource() *Container

func (*Container) IsValidOnDate

func (c *Container) IsValidOnDate(date time.Time) bool

type PKCS1PublicKey

type PKCS1PublicKey struct {
	N *big.Int
	E int
}

RSA public key PKCS#1 representation

type Service

type Service interface {
	CheckSignature(algo *signaturealgorithm.SignatureAlgorithm, signedSource, signature []byte) (err error)
	CheckSignatureFrom(parent *Container) error
	IsValidOnDate(date time.Time) bool
	EncodeToDER() ([]byte, error)
	EncodeToPEM() ([]byte, error)
	GetSource() *Container
}

type VerifyDigestError

type VerifyDigestError struct {
}

VerifyDigestError en: error - digest verify failed ru: ошибка - Верификация подписи не удалась

func (*VerifyDigestError) Error

func (e *VerifyDigestError) Error() string

Error en: error text formation ru: формирование текста ошибки

func (*VerifyDigestError) Is

func (e *VerifyDigestError) Is(target error) bool

Is en: compare with target error ru: сравнение с другой ошибкой

Directories

Path Synopsis
Package tbscertificate provides en: structure of the Container representation in the asn.1, methods for this structure and the decoding function from DER ru: структуру представления Container в asn.1, методы для этой структуры и функцию декодирования из DER asn.1 - Abstract Syntax Notation One (ASN.
Package tbscertificate provides en: structure of the Container representation in the asn.1, methods for this structure and the decoding function from DER ru: структуру представления Container в asn.1, методы для этой структуры и функцию декодирования из DER asn.1 - Abstract Syntax Notation One (ASN.
public-key-info
Package publickeyinfo provides en: structure of the public key representation in the asn.1, methods for this structure and the decoding function from DER ru: структуру представления публичного ключа в asn.1, методы для этой структуры и функцию декодирования из DER asn.1 - Abstract Syntax Notation One (ASN.
Package publickeyinfo provides en: structure of the public key representation in the asn.1, methods for this structure and the decoding function from DER ru: структуру представления публичного ключа в asn.1, методы для этой структуры и функцию декодирования из DER asn.1 - Abstract Syntax Notation One (ASN.

Jump to

Keyboard shortcuts

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