// AddTransform adds a Transform node to the appropriate location func (s *Signature) AddTransform(transformID TransformID) error { if s.refnode == nil { return errors.New("missing reference node: did you call AddReference() first?") } if _, err := clib.XMLSecTmplReferenceAddTransform(s.refnode, clib.TransformID(transformID)); err != nil { return err } return nil }
// AddReference adds a Reference node to the appropriate location func (s *Signature) AddReference(digestMethod TransformID, id, uri, nodeType string) error { rn, err := clib.XMLSecTmplSignatureAddReference( s.signnode, clib.TransformID(digestMethod), id, uri, nodeType, ) if err != nil { return err } s.refnode = rn return nil }
// 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 }