CertificateClient.DownloadCertificateAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
DownloadCertificateAsync(String, String, CancellationToken) |
Creates an X509Certificate2 from the specified certificate. |
DownloadCertificateAsync(DownloadCertificateOptions, CancellationToken) |
Creates an X509Certificate2 from the specified certificate. |
DownloadCertificateAsync(String, String, CancellationToken)
- Source:
- CertificateClient.cs
- Source:
- CertificateClient.cs
Creates an X509Certificate2 from the specified certificate.
public virtual System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>> DownloadCertificateAsync (string certificateName, string version = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DownloadCertificateAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>>
override this.DownloadCertificateAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>>
Public Overridable Function DownloadCertificateAsync (certificateName As String, Optional version As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of X509Certificate2))
Parameters
- certificateName
- String
The name of the certificate to download.
- version
- String
Optional version of a certificate to download.
- cancellationToken
- CancellationToken
A CancellationToken controlling the request lifetime.
Returns
An X509Certificate2 from the specified certificate.
Exceptions
The managed secret did not contain a certificate.
certificateName
is empty.
certificateName
is null.
The managed secret did not contain a certificate.
The CertificateContentType is not supported.
Cannot create an X509Certificate2 on this platform.
The request failed. See ErrorCode and the exception message for details.
Remarks
Because Cer contains only the public key, this method attempts to download the managed secret that contains the full certificate. If you do not have permissions to get the secret, RequestFailedException will be thrown with an appropriate error response. If you want an X509Certificate2 with only the public key, instantiate it passing only the Cer property. This operation requires the certificates/get and secrets/get permissions.
Applies to
DownloadCertificateAsync(DownloadCertificateOptions, CancellationToken)
- Source:
- CertificateClient.cs
- Source:
- CertificateClient.cs
Creates an X509Certificate2 from the specified certificate.
public virtual System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>> DownloadCertificateAsync (Azure.Security.KeyVault.Certificates.DownloadCertificateOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DownloadCertificateAsync : Azure.Security.KeyVault.Certificates.DownloadCertificateOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>>
override this.DownloadCertificateAsync : Azure.Security.KeyVault.Certificates.DownloadCertificateOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>>
Public Overridable Function DownloadCertificateAsync (options As DownloadCertificateOptions, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of X509Certificate2))
Parameters
- options
- DownloadCertificateOptions
Additional options for downloading and creating an X509Certificate2.
- cancellationToken
- CancellationToken
A CancellationToken controlling the request lifetime.
Returns
An X509Certificate2 from the specified certificate.
Exceptions
options
is null.
The managed secret did not contain a certificate.
The CertificateContentType is not supported.
Cannot create an X509Certificate2 on this platform.
The request failed. See ErrorCode and the exception message for details.
Remarks
Because Cer contains only the public key, this method attempts to download the managed secret that contains the full certificate. If you do not have permissions to get the secret, RequestFailedException will be thrown with an appropriate error response. If you want an X509Certificate2 with only the public key, instantiate it passing only the Cer property. This operation requires the certificates/get and secrets/get permissions.
Applies to
Azure SDK for .NET