Show / Hide Table of Contents

    Class CertUtils

    Certificates utilities

    Inheritance
    Object
    CertUtils
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.Graph.Communications.Common
    Assembly: Microsoft.Graph.Communications.Common.dll
    Syntax
    public static class CertUtils

    Methods

    GetCertificate(String, StoreLocation)

    Get certificate from the certificate store, throw exception if not found.

    Declaration
    public static X509Certificate2 GetCertificate(string thumbprint, StoreLocation location)
    Parameters
    Type Name Description
    String thumbprint

    The thumbprint.

    StoreLocation location

    The certificate store location.

    Returns
    Type Description
    X509Certificate2

    True if the certificate is found.

    HasPrivateKeyAccess(X509Certificate2, IGraphLogger)

    Verifies the private key access on a given certificate. If a logger is provided, the cert Common name and any errors are printed out.

    Declaration
    public static bool HasPrivateKeyAccess(this X509Certificate2 certificate, IGraphLogger logger = null)
    Parameters
    Type Name Description
    X509Certificate2 certificate

    The certificate.

    IGraphLogger logger

    The logger.

    Returns
    Type Description
    Boolean

    True if private key can be accessed, false otherwise.

    TryGetCertificate(String, StoreLocation)

    Tries to the get certificate from the certificate store.

    Declaration
    public static X509Certificate2 TryGetCertificate(string thumbprint, StoreLocation location)
    Parameters
    Type Name Description
    String thumbprint

    The thumbprint.

    StoreLocation location

    The certificate store location.

    Returns
    Type Description
    X509Certificate2

    True if the certificate is found.

    TryGetCertificate(String, String, StoreLocation)

    Tries to the get certificate from the certificate store.

    Declaration
    public static X509Certificate2 TryGetCertificate(string issuer, string enhancedKeyUsage, StoreLocation location)
    Parameters
    Type Name Description
    String issuer

    The issuer.

    String enhancedKeyUsage

    Enhanced key usage.

    StoreLocation location

    The certificate store location.

    Returns
    Type Description
    X509Certificate2

    True if the certificate is found.

    TryGetCertificateWithCommonName(String, StoreLocation)

    Tries to get certificate with common name from the certificate store.

    Declaration
    public static X509Certificate2 TryGetCertificateWithCommonName(string commonName, StoreLocation location)
    Parameters
    Type Name Description
    String commonName

    Name of the common.

    StoreLocation location

    The location.

    Returns
    Type Description
    X509Certificate2

    The certificate. null if not found.

    Back to top Copyright (c) Microsoft Corporation. All rights reserved.