Exemplo n.º 1
0
func XMLSecTmplSignatureCreateNsPref(doc types.Document, c14nMethod TransformID, signMethod TransformID, id string, prefix string) (types.Node, error) {
	docptr := (*C.xmlDoc)(unsafe.Pointer(doc.Pointer()))
	if docptr == nil {
		return nil, clib.ErrInvalidDocument
	}

	var xcid *C.xmlChar
	if id != "" {
		xcid = stringToXMLChar(id)
		defer C.free(unsafe.Pointer(xcid))
	}

	var xcprefix *C.xmlChar
	if prefix != "" {
		xcprefix = stringToXMLChar(prefix)
		defer C.free(unsafe.Pointer(xcprefix))
	}

	ptr := C.xmlSecTmplSignatureCreateNsPref(
		docptr,
		c14nMethod.ptr,
		signMethod.ptr,
		xcid,
		xcprefix,
	)
	if ptr == nil {
		return nil, errors.New("failed to create signature template")
	}

	return dom.WrapNode(uintptr(unsafe.Pointer(ptr)))
}