xmldsig

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LOGGER = logging.MustGetLogger("xmldsig")

Functions

func Canonicalise

func Canonicalise(xmlString string) (string, error)

Canonicalise the XML based on W3C standard, using another library

func GenerateSHA256Hash

func GenerateSHA256Hash(val string) ([]byte, error)

func GetElementByName

func GetElementByName(element *etree.Element, tag string) *etree.Element

func MarshallToXML

func MarshallToXML(data interface{}) (string, error)

func VerifySignature

func VerifySignature(xml string) bool

Types

type Algorithm

type Algorithm struct {
	Algorithm string `xml:",attr"`
}

Algorithm describes the digest or signature used when digest or signature.

type KeyInfo

type KeyInfo struct {
	XMLName  xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# KeyInfo"`
	X509Data *X509Data
	Children []interface{}
}

KeyInfo is an optional element that enables the recipient(s) to obtain the key needed to validate the signature.

type Reference

type Reference struct {
	XMLName      xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Reference"`
	URI          string   `xml:",attr,omitempty"`
	Transforms   Transforms
	DigestMethod Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# DigestMethod"`
	DigestValue  string    `xml:"http://www.w3.org/2000/09/xmldsig# DigestValue"`
}

Reference specifies a digest algorithm and digest value, and optionally an identifier of the object being signed, the type of the object, and/or a list of transforms to be applied prior to digesting.

type Sgntr

type Sgntr struct {
	XMLName   xml.Name `xml:"urn:iso:std:iso:20022:tech:xsd:head.001.001.01 Sgntr"`
	Signature Signature
}

Signature element is the root element of an XML Signature.

func NewSignature

func NewSignature() *Sgntr

type Signature

type Signature struct {
	XMLName        xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# Signature"`
	SignedInfo     SignedInfo
	SignatureValue string `xml:"http://www.w3.org/2000/09/xmldsig# SignatureValue"`
	KeyInfo        KeyInfo
}

type SignedInfo

type SignedInfo struct {
	XMLName                xml.Name  `xml:"http://www.w3.org/2000/09/xmldsig# SignedInfo"`
	CanonicalizationMethod Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# CanonicalizationMethod"`
	SignatureMethod        Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# SignatureMethod"`
	Reference              Reference
}

SignedInfo includes a canonicalization algorithm, a signature algorithm, and a reference.

type Transforms

type Transforms struct {
	XMLName   xml.Name    `xml:"http://www.w3.org/2000/09/xmldsig# Transforms"`
	Transform []Algorithm `xml:"http://www.w3.org/2000/09/xmldsig# Transform"`
}

Transforms is an optional ordered list of processing steps that were applied to the resource's content before it was digested.

type X509Data

type X509Data struct {
	XMLName         xml.Name `xml:"http://www.w3.org/2000/09/xmldsig# X509Data"`
	X509Certificate string   `xml:"http://www.w3.org/2000/09/xmldsig# X509Certificate"`
}

X509Data element within KeyInfo contains one an X509 certificate

type XmlWriteCloser

type XmlWriteCloser struct {
	io.Writer
}

The C14N library expect a WriteCloser type

func (XmlWriteCloser) Close

func (XmlWriteCloser) Close() error

Implement the Close() method of the WriteCloser Interface

Jump to

Keyboard shortcuts

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