Esempio n. 1
0
        public async Task Export_Import()
        {
            const string name = "self";
            var          _    = await _keyStoreService.CreateAsync(name, "ed25519", 0);

            var password = "******".ToCharArray();
            var pem      = await _keyStoreService.ExportAsync(name, password);

            Assert.That(pem, Does.StartWith("-----BEGIN ENCRYPTED PRIVATE KEY-----"));

            var keys = await _keyStoreService.ListAsync();

            var self = keys.Single(k => k.Name == name);

            await _keyStoreService.RemoveAsync("clone");

            var clone = await _keyStoreService.ImportAsync("clone", pem, password);

            Assert.AreEqual("clone", clone.Name);
            Assert.AreEqual(self.Id, clone.Id);
        }
Esempio n. 2
0
 public async Task <string> ExportAsync(string name,
                                        char[] password,
                                        CancellationToken cancel = default)
 {
     return(await _keyStoreService.ExportAsync(name, password, cancel).ConfigureAwait(false));
 }