CertificateClient.DownloadCertificate 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
DownloadCertificate(DownloadCertificateOptions, CancellationToken) |
Creates an X509Certificate2 from the specified certificate. |
DownloadCertificate(String, String, CancellationToken) |
Creates an X509Certificate2 from the specified certificate. |
DownloadCertificate(DownloadCertificateOptions, CancellationToken)
- Source:
- CertificateClient.cs
- Source:
- CertificateClient.cs
Creates an X509Certificate2 from the specified certificate.
public virtual Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2> DownloadCertificate (Azure.Security.KeyVault.Certificates.DownloadCertificateOptions options, System.Threading.CancellationToken cancellationToken = default);
abstract member DownloadCertificate : Azure.Security.KeyVault.Certificates.DownloadCertificateOptions * System.Threading.CancellationToken -> Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>
override this.DownloadCertificate : Azure.Security.KeyVault.Certificates.DownloadCertificateOptions * System.Threading.CancellationToken -> Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>
Public Overridable Function DownloadCertificate (options As DownloadCertificateOptions, Optional cancellationToken As CancellationToken = Nothing) As Response(Of X509Certificate2)
Parameters
- options
- DownloadCertificateOptions
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
DownloadCertificate(String, String, CancellationToken)
- Source:
- CertificateClient.cs
- Source:
- CertificateClient.cs
Creates an X509Certificate2 from the specified certificate.
public virtual Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2> DownloadCertificate (string certificateName, string version = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DownloadCertificate : string * string * System.Threading.CancellationToken -> Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>
override this.DownloadCertificate : string * string * System.Threading.CancellationToken -> Azure.Response<System.Security.Cryptography.X509Certificates.X509Certificate2>
Public Overridable Function DownloadCertificate (certificateName As String, Optional version As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As 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
Azure SDK for .NET