Certificate Certificate Certificate Certificate Class

Represents a cryptography certificate.

Syntax

Declaration

public sealed class Certificatepublic sealed class CertificatePublic NotInheritable Class Certificatepublic sealed class Certificate

Constructors summary

Create a new instance of the Certificate class using the specified certificate data.

Properties summary

Gets a collection of object identifiers (OIDs) for the enhanced key usage extension.

Gets or sets the friendly name for the certificate.

Gets a value indicating whether the certificate has a private key.

Gets whether the certificate is per-user.

Gets whether the security device is bound.

Gets a value that indicates whether the private key associated with the certificate is strongly protected.

Gets the name of the certificate issuer.

Gets the name of the cryptographic algorithm used to create the key.

Gets the certificate's key storage provider name.

Gets the key uses for the certificate.

Gets the serial number of the certificate.

Gets the signature algorithm name.

Gets the signature hash algorithm name.

Gets the certificate's store name.

Gets the subject name of the certificate.

Gets info on the subject alternative name.

Gets the date and time after which the certificate is valid.

Gets the date and time after which the certificate is no longer valid.

Methods summary

Build a certificate chain for the specified certificates starting from the end entity certificate to the root.

Build a certificate chain for the specified certificates starting from the end entity certificate to the root using the specified chain building parameters.

Gets the ASN.1 DER encoded certificate blob.

Gets the SHA1 hash value for the certificate.

Gets the hash value for the certificate for a specified algorithm.

Constructors

  • Certificate(IBuffer)
    Certificate(IBuffer)
    Certificate(IBuffer)
    Certificate(IBuffer)

    Create a new instance of the Certificate class using the specified certificate data.

    public Certificate(IBuffer certBlob)public New(IBuffer certBlob)Public Sub New(certBlob As IBuffer)public Certificate(IBuffer certBlob)

    Parameters

Properties

  • EnhancedKeyUsages
    EnhancedKeyUsages
    EnhancedKeyUsages
    EnhancedKeyUsages

    Gets a collection of object identifiers (OIDs) for the enhanced key usage extension.

    public IVectorView<string> EnhancedKeyUsages { get; }public IVectorView<string> EnhancedKeyUsages { get; }Public ReadOnly Property EnhancedKeyUsages As IVectorView<string>public IVectorView<string> EnhancedKeyUsages { get; }

    Property Value

    • A collection of object identifiers (OIDs) for the enhanced key usage extension

  • FriendlyName
    FriendlyName
    FriendlyName
    FriendlyName

    Gets or sets the friendly name for the certificate.

    public string FriendlyName { get; set; }public string FriendlyName { get; set; }Public ReadWrite Property FriendlyName As stringpublic string FriendlyName { get; set; }

    Property Value

    • string
      string
      string
      string

      The friendly name for the certificate. If the certificate does not have a friendly name set, then an empty string is returned.

  • HasPrivateKey
    HasPrivateKey
    HasPrivateKey
    HasPrivateKey

    Gets a value indicating whether the certificate has a private key.

    public bool HasPrivateKey { get; }public bool HasPrivateKey { get; }Public ReadOnly Property HasPrivateKey As boolpublic bool HasPrivateKey { get; }

    Property Value

    • bool
      bool
      bool
      bool

      True if the certificate has a private key; otherwise false.

  • IsPerUser
    IsPerUser
    IsPerUser
    IsPerUser

    Gets whether the certificate is per-user.

    public bool IsPerUser { get; }public bool IsPerUser { get; }Public ReadOnly Property IsPerUser As boolpublic bool IsPerUser { get; }

    Property Value

    • bool
      bool
      bool
      bool

      True if the certificate is per-user; otherwise, false.

  • IsSecurityDeviceBound
    IsSecurityDeviceBound
    IsSecurityDeviceBound
    IsSecurityDeviceBound

    Gets whether the security device is bound.

    public bool IsSecurityDeviceBound { get; }public bool IsSecurityDeviceBound { get; }Public ReadOnly Property IsSecurityDeviceBound As boolpublic bool IsSecurityDeviceBound { get; }

    Property Value

    • bool
      bool
      bool
      bool

      True if the security device is bound; otherwise, false.

  • IsStronglyProtected
    IsStronglyProtected
    IsStronglyProtected
    IsStronglyProtected

    Gets a value that indicates whether the private key associated with the certificate is strongly protected.

    public bool IsStronglyProtected { get; }public bool IsStronglyProtected { get; }Public ReadOnly Property IsStronglyProtected As boolpublic bool IsStronglyProtected { get; }

    Property Value

    • bool
      bool
      bool
      bool

      True if the certificate is strongly protected; otherwise false.

  • Issuer
    Issuer
    Issuer
    Issuer

    Gets the name of the certificate issuer.

    public string Issuer { get; }public string Issuer { get; }Public ReadOnly Property Issuer As stringpublic string Issuer { get; }

    Property Value

    • string
      string
      string
      string

      The name of the certificate issuer.

  • KeyAlgorithmName
    KeyAlgorithmName
    KeyAlgorithmName
    KeyAlgorithmName

    Gets the name of the cryptographic algorithm used to create the key.

    public string KeyAlgorithmName { get; }public string KeyAlgorithmName { get; }Public ReadOnly Property KeyAlgorithmName As stringpublic string KeyAlgorithmName { get; }

    Property Value

    • string
      string
      string
      string

      The name of the cryptographic algorithm used to create the key.

  • KeyStorageProviderName
    KeyStorageProviderName
    KeyStorageProviderName
    KeyStorageProviderName

    Gets the certificate's key storage provider name.

    public string KeyStorageProviderName { get; }public string KeyStorageProviderName { get; }Public ReadOnly Property KeyStorageProviderName As stringpublic string KeyStorageProviderName { get; }

    Property Value

    • string
      string
      string
      string

      The certificate's key storage provider name.

  • KeyUsages
    KeyUsages
    KeyUsages
    KeyUsages

    Gets the key uses for the certificate.

    public CertificateKeyUsages KeyUsages { get; }public CertificateKeyUsages KeyUsages { get; }Public ReadOnly Property KeyUsages As CertificateKeyUsagespublic CertificateKeyUsages KeyUsages { get; }

    Property Value

  • SerialNumber
    SerialNumber
    SerialNumber
    SerialNumber

    Gets the serial number of the certificate.

    public byte[] SerialNumber { get; }public byte[] SerialNumber { get; }Public ReadOnly Property SerialNumber As byte[]public byte[] SerialNumber { get; }

    Property Value

    • byte[]
      byte[]
      byte[]
      byte[]

      The serial number of the certificate.

  • SignatureAlgorithmName
    SignatureAlgorithmName
    SignatureAlgorithmName
    SignatureAlgorithmName

    Gets the signature algorithm name.

    public string SignatureAlgorithmName { get; }public string SignatureAlgorithmName { get; }Public ReadOnly Property SignatureAlgorithmName As stringpublic string SignatureAlgorithmName { get; }

    Property Value

    • string
      string
      string
      string

      The signature algorithm name.

  • SignatureHashAlgorithmName
    SignatureHashAlgorithmName
    SignatureHashAlgorithmName
    SignatureHashAlgorithmName

    Gets the signature hash algorithm name.

    public string SignatureHashAlgorithmName { get; }public string SignatureHashAlgorithmName { get; }Public ReadOnly Property SignatureHashAlgorithmName As stringpublic string SignatureHashAlgorithmName { get; }

    Property Value

    • string
      string
      string
      string

      The signature hash algorithm name.

  • StoreName
    StoreName
    StoreName
    StoreName

    Gets the certificate's store name.

    public string StoreName { get; }public string StoreName { get; }Public ReadOnly Property StoreName As stringpublic string StoreName { get; }

    Property Value

    • string
      string
      string
      string

      The certificate's store name.

  • Subject
    Subject
    Subject
    Subject

    Gets the subject name of the certificate.

    public string Subject { get; }public string Subject { get; }Public ReadOnly Property Subject As stringpublic string Subject { get; }

    Property Value

    • string
      string
      string
      string

      The subject name of the certificate.

  • SubjectAlternativeName
    SubjectAlternativeName
    SubjectAlternativeName
    SubjectAlternativeName

    Gets info on the subject alternative name.

    public SubjectAlternativeNameInfo SubjectAlternativeName { get; }public SubjectAlternativeNameInfo SubjectAlternativeName { get; }Public ReadOnly Property SubjectAlternativeName As SubjectAlternativeNameInfopublic SubjectAlternativeNameInfo SubjectAlternativeName { get; }

    Property Value

  • ValidFrom
    ValidFrom
    ValidFrom
    ValidFrom

    Gets the date and time after which the certificate is valid.

    public DateTime ValidFrom { get; }public DateTimeOffset ValidFrom { get; }Public ReadOnly Property ValidFrom As DateTimeOffsetpublic DateTime ValidFrom { get; }

    Property Value

  • ValidTo
    ValidTo
    ValidTo
    ValidTo

    Gets the date and time after which the certificate is no longer valid.

    public DateTime ValidTo { get; }public DateTimeOffset ValidTo { get; }Public ReadOnly Property ValidTo As DateTimeOffsetpublic DateTime ValidTo { get; }

    Property Value

Methods

  • BuildChainAsync(IIterable<Certificate>)
    BuildChainAsync(IIterable<Certificate>)
    BuildChainAsync(IIterable<Certificate>)
    BuildChainAsync(IIterable<Certificate>)

    Build a certificate chain for the specified certificates starting from the end entity certificate to the root.

    public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates)public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates)Public Function BuildChainAsync(certificates As IIterable<Certificate>) As IAsyncOperation( Of CertificateChain )public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates)

    Parameters

    • certificates

      The intermediate certificates to use when building the certificate chain.

    Returns

    • An asynchronous operation to retrieve the CertificateChain object that contains the entire certificate chain.

  • BuildChainAsync(IIterable<Certificate>, ChainBuildingParameters)
    BuildChainAsync(IIterable<Certificate>, ChainBuildingParameters)
    BuildChainAsync(IIterable<Certificate>, ChainBuildingParameters)
    BuildChainAsync(IIterable<Certificate>, ChainBuildingParameters)

    Build a certificate chain for the specified certificates starting from the end entity certificate to the root using the specified chain building parameters.

    public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates, ChainBuildingParameters parameters)public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates, ChainBuildingParameters parameters)Public Function BuildChainAsync(certificates As IIterable<Certificate>, parameters As ChainBuildingParameters) As IAsyncOperation( Of CertificateChain )public IAsyncOperation<CertificateChain> BuildChainAsync(IIterable<Certificate> certificates, ChainBuildingParameters parameters)

    Parameters

    Returns

    • An asynchronous operation to retrieve the CertificateChain object that contains the entire certificate chain.

  • GetCertificateBlob()
    GetCertificateBlob()
    GetCertificateBlob()
    GetCertificateBlob()

    Gets the ASN.1 DER encoded certificate blob.

    public IBuffer GetCertificateBlob()public IBuffer GetCertificateBlob()Public Function GetCertificateBlob() As IBufferpublic IBuffer GetCertificateBlob()

    Returns

  • GetHashValue()
    GetHashValue()
    GetHashValue()
    GetHashValue()

    Gets the SHA1 hash value for the certificate.

    public byte[] GetHashValue()public byte[] GetHashValue()Public Function GetHashValue() As byte[]public byte[] GetHashValue()

    Returns

    • byte[]
      byte[]
      byte[]
      byte[]

      The SHA1 hash value for the certificate.

  • GetHashValue(String)
    GetHashValue(String)
    GetHashValue(String)
    GetHashValue(String)

    Gets the hash value for the certificate for a specified algorithm.

    public byte[] GetHashValue(String hashAlgorithmName)public byte[] GetHashValue(String hashAlgorithmName)Public Function GetHashValue(hashAlgorithmName As String) As byte[]public byte[] GetHashValue(String hashAlgorithmName)

    Parameters

    • hashAlgorithmName
      System.String
      System.String
      System.String
      System.String

      The hash algorithm to use for the hash value of the certificate. Only values of "SHA1" or "SHA256" are supported. To get the SHA2 hash value for the certificate, specify "SHA256".

    Returns

    • byte[]
      byte[]
      byte[]
      byte[]

      The hash value of the certificate.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Security.Cryptography.Certificates.dll