共用方式為


CertificateObject 介面

表示已用來建立簽章的 X.509 數位憑證。

**命名空間:**Microsoft.Office.Interop.InfoPath
**組件:**Microsoft.Office.Interop.InfoPath (於 microsoft.office.interop.infopath.dll 中)

語法

'宣告
<CoClassAttribute(GetType(CertificateObjectClass))> _
<GuidAttribute("096CD71A-0786-11D1-95FA-0080C78EE3BB")> _
Public Interface CertificateObject
    Inherits Certificate
'用途
Dim instance As CertificateObject
[CoClassAttribute(typeof(CertificateObjectClass))] 
[GuidAttribute("096CD71A-0786-11D1-95FA-0080C78EE3BB")] 
public interface CertificateObject : Certificate

備註

此類型為 coclass 的包裝函式,屬於 COM 互通性中 Managed 程式碼的必要項。使用此類型,即可存取由此 coclass 實作的 COM 介面成員。如需 COM 介面 (包括其成員說明連結) 的詳細資訊,請參閱 Certificate

使用 SignatureObject 物件的 Certificate 屬性來傳回 Certificate 物件。

範例

下列範例使用 Certificate 物件的多個屬性以判斷狀態,並顯示含有多個 Certificate 物件屬性的訊息方塊:

public void CertificatePropertiesAlert()
{
 Certificate myCertificate = thisXDocument.SignedDataBlocks[0].Signatures[0].Certificate;
 string status = "Undefined";
 switch(myCertificate.Status)
 {
  case XdCertificateStatus.xdCertificateStatusValid :
   status = "Valid";
   break;
  case XdCertificateStatus.xdCertificateStatusError :
   status = "Error";
   break;
  case XdCertificateStatus.xdCertificateStatusExpired :
   status = "Expired";
    break;
  case XdCertificateStatus.xdCertificateStatusNotTrusted :
   status = "Not Trusted";
   break;
  case XdCertificateStatus.xdCertificateStatusRevoked :
   status = "Revoked";
   break;
  default:
   break;
  }
  thisXDocument.UI.Alert(" IssuedTo = " + myCertificate.IssuedTo + "\n IssuedBy = " + myCertificate.IssuedBy + "\n ExpirationDate = " + myCertificate.ExpirationDate + "\n Status = " + status);
}

請參閱

參考

CertificateObject 成員
Microsoft.Office.Interop.InfoPath 命名空間