Ejemplo n.º 1
0
// NewSignature creates a Signature object.
func NewSignature(n types.Node, c14n, sig TransformID, id string) (*Signature, error) {
	doc, err := n.OwnerDocument()
	if err != nil {
		return nil, err
	}

	signnode, err := clib.XMLSecTmplSignatureCreateNsPref(
		doc,
		clib.TransformID(c14n),
		clib.TransformID(sig),
		id,
		clib.Prefix,
	)
	if err != nil {
		return nil, err
	}

	n.AddChild(signnode)

	return &Signature{
		signmethod: sig,
		signnode:   signnode,
	}, nil
}