Initialize方法示例
2015-12-15 22:24:32 来源: 评论:0 点击:
下列示例创建 ,检查节点是否启用了电子签名,并确定指定的标签(FIX32.thisnode.D01.F_CV)是否需要电子签名。如有需要,示例会验证签名,写入新值,并向审计跟踪发送一条消息。
Dim ESig As Object
Dim bNodeSignEnabled As Boolean
Dim bSigRequired As Boolean
Dim bVerify As Boolean
Dim bContinuousUse As Boolean
Dim nInfo As Integer
Dim NewValue As Variant
'创建ESignature对象
Set ESig = CreateObject("ElectronicSignature.ESignatureFactory")
'检查节点是否启用了电子签名
ESig.IsNodeSignEnabled bNodeSignEnabled
If bNodeSignEnabled = True Then
'检查标签是否要求电子签名
ESig.Initialize "Fix32.thisnode.DO1.F_CV"
ESig.IsSignatureRequired 0, bSigRequired, nInfo, bVerify, bContinuousUse
If bSigRequired = True Then
'验证签名,写入新值并向审计跟踪发送一条消息
NewValue = 1
If bVerify = False Then
ESig.ValidateSignatureAndWriteValue 0, NewValue, "admin", "admin", "Perform Comment Example"
Else
ESig.ValidateSignatureAndWriteValue 0, NewValue, "admin", "admin", "Perform Comment Example", "supervisor1", "GEF", "Verify Comment Example"
End If
Else
MsgBox "Signature is not required for this tag."
End If
Else
MsgBox "Signature is not enabled on this node."
End If