/// <summary>
        /// Convert the specified Cryptography Certificate to a .Net X509Certificate2 object
        /// with the corresponding private key structure.
        /// </summary>
        /// <param name="Certificate">The certificate to convert.</param>
        /// <returns>The .Net X509Certificate2 object</returns>
        static X509Certificate2 X509CertificateAndKey(GCP.Certificate Certificate) {
            var X509 = new X509Certificate2(Certificate.Data);
            CryptoProviderAsymmetric Provider;
            if (Certificate.CryptoProviderSignature != null) {
                Provider = Certificate.CryptoProviderSignature;
                }
            else {
                Provider = Certificate.CryptoProviderExchange;
                }
            var KeyPair = Provider.KeyPair;


            X509.PrivateKey = Provider.KeyPair.AsymmetricAlgorithm;
            return X509;
            }
 /// <summary>
 /// Register a certificate in the default Windows store and location
 /// for that type of certificate.
 /// </summary>
 /// <param name="Certificate">Certificate to register.</param>
 public static new void RegisterTrustedRoot(GCP.Certificate Certificate) {
     Register(Certificate, StoreName.Root, StoreLocation.LocalMachine);
     }
 /// <summary>
 /// Register a certificate in the default Windows store and location
 /// for that type of certificate.
 /// </summary>
 /// <param name="Certificate">Certificate to register.</param>
 public static new void Register(GCP.Certificate Certificate) {
     Register(Certificate, StoreName.My, StoreLocation.CurrentUser);
     }
 /// <summary>
 /// Convert the specified Cryptography Certificate to a .Net X509Certificate2 object
 /// </summary>
 /// <param name="Certificate">The certificate to convert.</param>
 /// <returns>The .Net X509Certificate2 object</returns>
 static X509Certificate2 X509Certificate2(GCP.Certificate Certificate) {
     return new X509Certificate2(Certificate.DER());
     }
 /// <summary>
 /// Register a certificate in the specified Windows store *and location.
 /// </summary>
 /// <param name="Certificate">Certificate to register.</param>
 /// <param name="StoreName">The certificate store to register the certificate to</param>
 /// <param name="StoreLocation">The type of certificate store.</param>
 public static void Register(GCP.Certificate Certificate,
             StoreName StoreName, StoreLocation StoreLocation) {
     var X509 = X509CertificateAndKey(Certificate);
     Register(X509, StoreName, StoreLocation);
     }