IsCertificateRevoked 属性
优质
小牛编辑
123浏览
2023-12-01
如果对应于 Signature 对象的数码证书已经被证书颁发者宣布无效,则返回 。Boolean 类型,只读。
expression.IsCertificateRevoked
expression 必需。该表达式返回“应用于”列表中的对象之一。
示例
本示例提示用户选择 Microsoft Word 中活动文档的数字签名。要使用本示例,请在 Word 中打开文档,并向该函数传递与“数码证书”对话框中数码证书的“颁发者”和“颁发给”字段相符的证书颁发者名字和证书签署者名字。该函数在将新签名提交到磁盘之前将进行测试以确保用户所选择的数字签名满足指定条件,例如没有过期。
Function AddSignature(ByVal strIssuer As String, _
strSigner As String) As Boolean
On Error GoTo Error_Handler
Dim sig As Signature
'Display the dialog box that lets the
'user select a digital signature.
'If the user selects a signature, then
'it is added to the Signatures
'collection. If the user doesn't, then
'an error is returned.
Set sig = ActiveDocument.Signatures.Add
'Test several properties before commiting the Signature object to disk.
If sig.Issuer = strIssuer And _
sig.Signer = strSigner And _
sig.IsCertificateExpired = False And _
sig.IsCertificateRevoked = False And _
sig.IsValid = True Then
MsgBox "Signed"
AddSignature = True
'Otherwise, remove the Signature object from the SignatureSet collection.
Else
sig.Delete
MsgBox "Not signed"
AddSignature = False
End If
'Commit all signatures in the SignatureSet collection to the disk.
ActiveDocument.Signatures.Commit
Exit Function
Error_Handler:
AddSignature = False
MsgBox "Action cancelled."
End Function