internal virtual ExportCertificateResponse ExportCertificate(ExportCertificateRequest request)
        {
            var marshaller   = ExportCertificateRequestMarshaller.Instance;
            var unmarshaller = ExportCertificateResponseUnmarshaller.Instance;

            return(Invoke <ExportCertificateRequest, ExportCertificateResponse>(request, marshaller, unmarshaller));
        }
Exemple #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the ExportCertificate operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the ExportCertificate operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ExportCertificate">REST API Reference for ExportCertificate Operation</seealso>
        public virtual Task<ExportCertificateResponse> ExportCertificateAsync(ExportCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = ExportCertificateRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ExportCertificateResponseUnmarshaller.Instance;

            return InvokeAsync<ExportCertificateResponse>(request, options, cancellationToken);
        }
Exemple #3
0
        internal virtual ExportCertificateResponse ExportCertificate(ExportCertificateRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = ExportCertificateRequestMarshaller.Instance;
            options.ResponseUnmarshaller = ExportCertificateResponseUnmarshaller.Instance;

            return Invoke<ExportCertificateResponse>(request, options);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the ExportCertificate operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the ExportCertificate operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/ExportCertificate">REST API Reference for ExportCertificate Operation</seealso>
        public virtual Task <ExportCertificateResponse> ExportCertificateAsync(ExportCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = ExportCertificateRequestMarshaller.Instance;
            var unmarshaller = ExportCertificateResponseUnmarshaller.Instance;

            return(InvokeAsync <ExportCertificateRequest, ExportCertificateResponse>(request, marshaller,
                                                                                     unmarshaller, cancellationToken));
        }
Exemple #5
0
        public async Task <X509Certificate2> GetCertificate(string arn)
        {
            var passPharse = Guid.NewGuid().ToString();
            var ms         = new MemoryStream(Encoding.UTF8.GetBytes(passPharse));
            var request    = new ExportCertificateRequest
            {
                CertificateArn = arn,
                Passphrase     = ms
            };

            try
            {
                var response = await amazonCertificateManager.ExportCertificateAsync(request);

                if (response.HttpStatusCode != System.Net.HttpStatusCode.OK)
                {
                    throw new Exception("ugh!");
                }
                var pub             = GetBytesFromPEM(response.Certificate);
                var chain           = new X509Certificate2(GetBytesFromPEM(response.CertificateChain));
                var privateKeyBytes = GetPrivateBytes(response.PrivateKey);
                var privateKey      = DecodePrivateKey(response.PrivateKey, passPharse);
                var rsaPrivateKey   = DotNetUtilities.ToRSA(privateKey.Private as RsaPrivateCrtKeyParameters);
                var cert            = new X509Certificate2(pub)
                {
                    PrivateKey   = rsaPrivateKey,
                    FriendlyName = "axs",
                };
                var certChain = Verify(cert, chain);
                return(cert);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw e;
            }
        }