dsig

package
v0.0.0-...-5cc2439 Latest Latest
Warning

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

Go to latest
Published: May 6, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Ctx

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

func NewCtx

func NewCtx(mngr *crypto.KeyManager) (*Ctx, error)

NewCtx creates a new XML Signature Context

func (*Ctx) Free

func (d *Ctx) Free() error

Free releases the underlying C structure

func (Ctx) Pointer

func (d Ctx) Pointer() uintptr

func (*Ctx) SetKey

func (d *Ctx) SetKey(key clib.PtrSource) error

func (*Ctx) Sign

func (d *Ctx) Sign(doc types.Document) error

Sign signs the given document. It automatically searches for the "Signature" node with the namespace "http://www.w3.org/2000/09/xmldsig#".

func (*Ctx) SignNode

func (d *Ctx) SignNode(n types.Node) error

SignNode signs the given node.

func (*Ctx) Verify

func (d *Ctx) Verify(doc types.Document) error

Verify verifies the signature in the given document. It automatically searches for the "Signature" node with the namespace "http://www.w3.org/2000/09/xmldsig#".

func (*Ctx) VerifyNode

func (d *Ctx) VerifyNode(n types.Node) error

VerifyNode verifies the signature in the given node

type Signature

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

func NewSignature

func NewSignature(n types.Node, c14n, sig TransformID, id string) (*Signature, error)

NewSignature creates a Signature object.

func (*Signature) AddKeyValue

func (s *Signature) AddKeyValue() error

AddKeyValue adds KeyValue nodes to appropriate location. Before adding these nodes, EnsureKeyInfo is called to makes ure KeyInfo node is created and added.

func (*Signature) AddReference

func (s *Signature) AddReference(digestMethod TransformID, id, uri, nodeType string) error

AddReference adds a Reference node to the appropriate location

func (*Signature) AddTransform

func (s *Signature) AddTransform(transformID TransformID) error

AddTransform adds a Transform node to the appropriate location

func (*Signature) AddX509Data

func (s *Signature) AddX509Data() error

AddX509Data adds a X509Data node to the apprpriate location

func (*Signature) EnsureKeyInfo

func (s *Signature) EnsureKeyInfo(ids ...string) error

EnsureKeyInfo adds a KeyInfo node to the apprpriate location

func (*Signature) Sign

func (s *Signature) Sign(key *crypto.Key) error

Sign populates the signature for the payload. The signature is generated using the specified key

type SignatureVerify

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

SignatureVerify is a convenience wrapper for things that can verify XML strings

func NewSignatureVerify

func NewSignatureVerify() (*SignatureVerify, error)

func (*SignatureVerify) Free

func (v *SignatureVerify) Free()

func (*SignatureVerify) LoadKeyFromFile

func (v *SignatureVerify) LoadKeyFromFile(file string, format crypto.KeyDataFormat) error

func (*SignatureVerify) Verify

func (v *SignatureVerify) Verify(buf []byte) error

func (*SignatureVerify) VerifyString

func (v *SignatureVerify) VerifyString(buf string) error

type TransformID

type TransformID clib.TransformID

Jump to

Keyboard shortcuts

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