Exemple #1
0
 public void ProvisionThaliClient()
 {
     var clientCert          = ThaliClientToDeviceHubUtilities.ProvisionThaliClient(Host, Port, tempDirectory);
     var serverKey           = ThaliClientToDeviceHubUtilities.GetServersRootPublicKey(Host, Port, clientCert);
     var couchClient         = ThaliClientToDeviceHubUtilities.GetCouchClient(serverKey, Host, Port, clientCert);
     var myPrincipalDatabase = couchClient.GetDatabase(ThaliCryptoUtilities.KeyDatabaseName);
     var keyId        = BogusAuthorizeCouchDocument.GenerateRsaKeyId(new BigIntegerRSAPublicKey(clientCert));
     var clientKeyDoc = myPrincipalDatabase.GetDocument <BogusAuthorizeCouchDocument>(keyId);
 }
        private static XmlHttpResponse ExecuteProvisionLocalClientToLocalHub(
            XmlHttpRequest xmlHttpRequest,
            X509Certificate2 clientCert)
        {
            var hubHttpKeyUri = DiscoverRootCertIfNeeded(HttpKeyUri.BuildHttpKeyUri(xmlHttpRequest.url), clientCert);

            ThaliClientToDeviceHubUtilities.ProvisionThaliClient(
                hubHttpKeyUri.ServerPublicKey,
                hubHttpKeyUri.Host,
                hubHttpKeyUri.Port,
                clientCert);

            return new XmlHttpResponse { status = 200, transactionId = xmlHttpRequest.transactionId, responseText = hubHttpKeyUri.AbsoluteUri };
        }
Exemple #3
0
        public void Setup()
        {
            var tempDirectoryForSetupPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            tempDirectoryForSetup = Directory.CreateDirectory(tempDirectoryForSetupPath);
            var clientCert      = ThaliClientToDeviceHubUtilities.GetLocalClientCertificate(tempDirectoryForSetup);
            var serverPublicKey = ThaliClientToDeviceHubUtilities.GetServersRootPublicKey(Host, Port, clientCert);

            ThaliClientToDeviceHubUtilities.ProvisionThaliClient(serverPublicKey, Host, Port, clientCert);
            var couchClient = ThaliClientToDeviceHubUtilities.GetCouchClient(serverPublicKey, Host, Port, clientCert);

            var response = couchClient.DeleteDatabase(TestDatabaseName);

            var tempDirectoryPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            tempDirectory = Directory.CreateDirectory(tempDirectoryPath);
        }