xades

package module
v0.0.0-...-310780a Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: Apache-2.0 Imports: 10 Imported by: 1

README

goxades_sri

This implementation is based on https://github.com/artemkunich/goxades - refer there for the original code. The code here has been heavily modified to suit the requirements for Electronic Signatures in Ecuador, especially for the purpose of signing invoices in a format appropriate for SRI. In most cases, the code works the same as the original project if you don't use any extra options. However, by using the new options you can make the project generate output appropriate for SRI, including identifiers with random numbers in them and other necessary components.

Documentation

Index

Constants

View Source
const (
	SignedPropertiesTag           string = "SignedProperties"
	SignedSignaturePropertiesTag  string = "SignedSignatureProperties"
	SigningTimeTag                string = "SigningTime"
	SigningCertificateTag         string = "SigningCertificate"
	CertTag                       string = "Cert"
	IssuerSerialTag               string = "IssuerSerial"
	CertDigestTag                 string = "CertDigest"
	QualifyingPropertiesTag       string = "QualifyingProperties"
	MimeTypeTag                   string = "MimeType"
	DescriptionTag                string = "Description"
	DataObjectFormatTag           string = "DataObjectFormat"
	SignedDataObjectPropertiesTag string = "SignedDataObjectProperties"
)
View Source
const (
	EtsiNamespace string = "http://uri.etsi.org/01903/v1.3.2#"
)

Variables

This section is empty.

Functions

func CreateSignature

func CreateSignature(signedData *etree.Element, ctx *SigningContext) (*etree.Element, error)

CreateSignature create filled signature element

func DigestValue

func DigestValue(element *etree.Element, canonicalizer *dsig.Canonicalizer, hash crypto.Hash) (base64encoded string, err error)

DigestValue calculate hash for digest

func SignatureValue

func SignatureValue(element *etree.Element, canonicalizer *dsig.Canonicalizer, hash crypto.Hash, keyStore *MemoryX509KeyStore) (base64encoded string, err error)

SignatureValue calculate signature

Types

type MemoryX509KeyStore

type MemoryX509KeyStore struct {
	PrivateKey *rsa.PrivateKey
	Cert       *x509.Certificate
	CertBinary []byte
}

MemoryX509KeyStore struct

func (*MemoryX509KeyStore) GetKeyPair

func (ks *MemoryX509KeyStore) GetKeyPair() (*rsa.PrivateKey, []byte, error)

GetKeyPair func

type SignedDataContext

type SignedDataContext struct {
	Canonicalizer dsig.Canonicalizer
	Hash          crypto.Hash
	ReferenceURI  string
	IsEnveloped   bool
}

type SignedPropertiesContext

type SignedPropertiesContext struct {
	Canonicalizer dsig.Canonicalizer
	Hash          crypto.Hash
	SigninigTime  time.Time
}

type SigningContext

type SigningContext struct {
	DataContext                       SignedDataContext
	PropertiesContext                 SignedPropertiesContext
	Canonicalizer                     dsig.Canonicalizer
	Hash                              crypto.Hash
	KeyStore                          MemoryX509KeyStore
	DsigNamespacePrefix               string
	EtsiNamespacePrefix               string
	EtsiNamespaceAtTopLevel           bool
	SignatureId                       string
	SignedInfoId                      string
	SignatureValueId                  string
	KeyInfoId                         string
	ObjectId                          string
	SignedPropertiesId                string
	ReferenceMainDocumentId           string
	ReferencePropertiesId             string
	IncludeKeyValue                   bool
	IncludeSignedDataObjectProperties bool
	SignedDataObjectDescription       string
	ReferenceCertificate              bool
	ReferenceDataLast                 bool
	ReferenceAvoidTransformElements   bool
}

Jump to

Keyboard shortcuts

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